(shra_contribution<\/em>). \u0412 hook_menu \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043f\u0430\u0440\u0443 \u0430\u0439\u0442\u0435\u043c\u043e\u0432:<\/p>\n\/* hook menu *\/\r\nfunction shra_contribution_menu() {\r\n \/\/\u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435\r\n $items['admin\/structure\/taxonomy\/export'] = array(\r\n 'title' => '- \u0412\u0441\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u0433\u043e csv',\r\n 'page callback' => '_sc_admin_tax_txt',\r\n 'access arguments' => array('access administration menu'),\r\n 'type' => MENU_LOCAL_TASK,\r\n );\r\n \/\/\u0441\u0430\u043c \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u043a\u0438\r\n $items['admin\/structure\/taxonomy\/export-cvs'] = array(\r\n 'page callback' => '_sc_admin_tax_txt',\r\n 'access arguments' => array('access administration menu'), \r\n 'type' => MENU_CALLBACK,\r\n ); \r\n return $items; \r\n}<\/pre>\n\u0410 \u0432\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u0444\u0430\u0439\u043b \u0432\u044b\u0434\u0430\u0451\u0442 \u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043e \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442:<\/p>\n
\/* \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0441\u043e\u043d\u043e\u043c\u0438\u044e \u0432 \u0432\u0438\u0434\u0435 csv *\/\r\nfunction _sc_admin_tax_txt($type = NULL) {\r\n if (arg(3) == 'export-cvs') {\r\n \/\/\u0433\u0440\u0443\u0437\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439\r\n $res = db_query(\"SELECT vid, name FROM taxonomy_vocabulary ORDER BY name\");\r\n $dictCount = $res->rowCount();\r\n $maxAmount = 0;\r\n $table = array();\r\n \r\n \/\/\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u043b\u043e\u0441\u043a\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443\r\n if ($dictCount) {\r\n $nD = 0;\r\n while ($r = $res->fetchObject()) {\r\n \r\n $table[$nD * 2][0] = $r->name;\r\n $terms = taxonomy_get_tree($r->vid);\r\n if (count($terms) > $maxAmount)\r\n $maxAmount = count($terms);\r\n \r\n foreach ($terms as $k => $v ) {\r\n \/\/\u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0435\u0440\u043c\u0438\u043d\u0443 \u044f \u0431\u0435\u0440\u0443 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\r\n \/\/\u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438\r\n \/\/\u0442.\u0435. \u043d\u0430 1 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u043c 2 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\r\n $table[$nD * 2][$k + 1] = $v->name;\r\n $table[$nD * 2 + 1][$k + 1] = $v->depth;\r\n }\r\n $nD ++;\r\n }\r\n }\r\n \r\n \/\/\u0432\u044b\u0432\u043e\u0434 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 csv \u0444\u0430\u0439\u043b\r\n header('Content-Type: application\/download; charset=windows-1251');\r\n header('Content-Disposition: attachment; filename=\"taxonomy.csv\"');\r\n $out = fopen('php:\/\/output', 'w');\r\n \r\n for ($j = 0; $j < $maxAmount; $j++) {\r\n $C = array();\r\n for($col = 0; $col < $dictCount * 2; $col ++) {\r\n if (isset($table[$col][$j]))\r\n $C[] = iconv ('UTF-8', 'CP1251', $table[$col][$j]);\r\n else \r\n $C[] = '';\r\n }\r\n \/\/Excel \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \"\u043b\u044e\u0431\u0438\u0442\" \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438\r\n \/\/\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e ;\r\n \/\/\u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u0435\u043d \u0441\u0438\u043c\u0432\u043e\u043b \u0442\u0430\u0431\u0443\u043b\u044f\u0446\u0438\u0438\r\n \/\/fputcsv($out, $C, chr(9));\r\n fputcsv($out, $C, ';'); \r\n }\r\n fclose($out);\r\n exit;\r\n }\r\n return '<p>\u0412\u0441\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 \r\n <a href=\"\/admin\/structure\/taxonomy\/export-cvs\">\u0444\u0430\u0439\u043b\u0430 csv<\/a>.<\/p>'; \r\n}<\/pre>\n\u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043b\u0441\u043e\u0442\u043d\u0438 \u0441\u0442\u0440\u043e\u043a, \u0432\u043c\u0435\u0441\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0430-\u043b\u044f «\u0448\u0432\u0435\u0439\u0446\u0430\u0440\u0441\u043a\u0438\u0439 \u043d\u043e\u0436».<\/p>\n","protected":false},"excerpt":{"rendered":"
\u041f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0430\u0441\u044c \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0432\u0441\u0435\u0439 \u043a\u0443\u0447\u0438 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435. \u041d\u0435 \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430, \u0430 \u0442\u0430\u043a: \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430\u043c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u043c \u043f\u043e\u043b\u0437\u0430\u0442\u044c \u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c, \u0430 \u0447\u0435\u0433\u043e \u043d\u0435\u0442. \u0414\u0435\u043b\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u043a\u0443\u0441\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-8915","post","type-post","status-publish","format-standard","hentry","category-drupal"],"acf":[],"yoast_head":"\n
\u0412\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 \u0442\u0430\u043a\u0441\u043e\u043d\u043e\u043c\u0438\u0438 \u0432 csv \u0438\u0437 Drupal<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n