/source/gl/module/module.php
http://prosporous.googlecode.com/ · PHP · 195 lines · 167 code · 13 blank · 15 comment · 39 complexity · f588e66bb54b0af1b3a316476ace498a MD5 · raw file
- <?php
- /* * ??????UTF-8???.
- * Created on 2010-6-3
- *
- * @author EXT <isrn@qq.com>
- *
- */
- include ('../../includes/global.php');
- include ('../global.php');
- include ("../power.php");
-
- switch ($_REQUEST['op']) {
- case 'updata': {
- function getparentidsorts($id, $table) {
- //???????
- global $db, $prefix;
- $sorts = mysql_query("SELECT parentid FROM se_" . $table . " WHERE id='" . $id . "'");
- while ($sort = mysql_fetch_array($sorts)) {
- $id .=",";
- $id .=getparentidsorts($sort[parentid], $table);
- }
- return $id;
- }
- function backdselect($id, $table) {
- //???????
- global $db, $prefix;
- mysql_query("UPDATE se_" . $table . " SET plist='" . getparentidsorts($id, $table) . "' WHERE id='" . $id . "'");
- //echo "UPDATE ".$prefix."_".$table." SET plist='".getparentidsorts($id,$table)."' WHERE id='".$id."'";
- }
- if ($_POST['id'] != '') {
- if (Du('sevenel', 'sort', $_POST, 'id', $_POST['id'], 1)) backdselect($_POST['id'], 'sort');
- ja('????');
- }else {
- if (Di('sevenel', 'sort', $_POST)) ;
- backdselect(mysql_insert_id(), 'sort');
- ja('????');
- }
- ?>
- <script>
- n=parent.tabs.getActiveTab();
- parent.tabs.remove(n);
- </script><?php
- break;
- }
- case 'add': {
- $drop_down_info = '';
- function drop_down($id, $i, $selected, $table, $lang, $mid, $minfo) {
- global $drop_down_info;
- //fal($id,$i,$selected,$table,$mid,$minfo);
- $temp = Dgs($table, " parentid='" . $id . "' and lg like '" . $lang . "' and del != '1'");
- if ($temp != '') {
- foreach ($temp as $p) { if (@in_array($p['id'], $selected) || $p['id'] == $selected) {
- $drop_down_info.="<option value=\"" . $p['id'] . "\" selected=\"selected\">" . str_repeat('--', $i) . $p['title'] . "</option>";
- } else {
-
- $drop_down_info.="<option value=\"" . $p['id'] . "\">" . str_repeat('?', $i) . $p['title'] . "</option>";
- }
- $qq = Dgs($table, " parentid='" . $p['id'] . "' and lg like '" . $lang . "' and del != '1'");
- if ($qq != '') { $j = $i + 1;
- @drop_down($p[id], $j, $selected, $table, $lang);
- }
- }
- if ($mid !== '' && $minfo != '') {
- $drop_down_info = "<option value=\"" . $mid . "\">" . $minfo . "</option>" . $drop_down_info;
- }
- } else {
- if ($mid != '' && $minfo != '') {
- $drop_down_info = "<option value=\"" . $mid . "\">" . $minfo . "</option>" . $drop_down_info;
- }
- }
- }
- if ($_GET['id']) {
- $edite = Dgd(array(
- 'db' => 'd_sevenel',
- 'cd' => " id = '" . $_GET['id'] . "' and del != '1' ",
- 'tn' => "sort",
- 'limit' => 1
- ));
- drop_down(-1, 0, $edite['parentid'], 'sort', 'zh', '-1', '???');
- Tr($drop_down_info, 'option');
- Tr($edite, 'info');
- }
- if ($_GET['pid']) {
- $edite = Dgd(array(
- 'db' => 'd_sevenel',
- 'cd' => " id = '" . $_GET['pid'] . "' and del != '1' ",
- 'tn' => "sort",
- 'limit' => 1
- ));
- drop_down(-1, 0, $_GET['pid'], 'sort', 'zh', '-1', '???');
- Tr($drop_down_info, 'option');
- //Tr($edite,'info');
- }
- // print_r($drop_down_info);
- Ts('module/add.html');
- break; }
- case 'list': {
-
- $_GET['rootIndex'] || $_GET['rootIndex'] = 1;
-
- function buildsortnav($id, $table) {
- $navbit = " <a href=\"./module.php?op=list&id=-1\">???</a>";
- if ($id != -1) {
- $temp = Dga($table, "id ='" . $id . "'");
- $zistr = explode(",", $temp[plist]);
- $j = count($zistr);
- if ($j > 2) {
- for ($i = 1; $i < $j - 1; $i++) {
- $temp1 = Dga($table, "id ='" . $zistr[$i] . "' ");
- $subRootIndex = $temp1['rootIndex'] +1;
- $navbit .= " / <a href=\"./module.php?op=list&id=" . $temp1[id] . "&rootIndex={$subRootIndex}\">" . $temp1['title'] . "</a>";
- }
- }
- $subRootIndex = $temp['rootIndex'] +1;
- $navbit .= " / <a href=\"./module.php?op=list&id=" . $temp[id] . "&rootIndex={$subRootIndex}\">" . $temp['title'] . "</a>";
- }
- return $navbit;
- }
- if (empty($_GET[id])) {
- $_GET[id] = "-1";
- }
-
- $dcfg['name'] = 'sort';
- $sortnav = buildsortnav($_GET[id], $dcfg['name']);
- $Tp->assign("sortnav", $sortnav);
-
- if (isset($_POST[offset]) and isset($_POST[pageline])) {
- $classtest = new tviewpage("se_" . $dcfg['name'], $_POST[pageline], $_POST[offset]);
- //echo "Post";
- } elseif (isset($_GET[offset]) and isset($_GET[pageline])) {
- $classtest = new tviewpage("se_" . $dcfg['name'], $_GET[pageline], $_GET[offset]);
- //echo "GET";
- } else {
-
- $offset = 0;
- $pageline = 5;
- $classtest = new tviewpage("se_" . $dcfg['name'], $pageline, $offset);
-
- //echo "none";
- }
-
- $classtest->setCondition(" where parentid=" . $_GET[id] . " and ( title like '%" . $_GET['title'] . "%') and del !='1' ORDER BY `id` asc ");
-
- $classtest->setPageQuery('op', 'list');
- $classtest->setPageQuery('id', $_GET[id]);
- $classtest->setPageQuery('title', $_GET['title']);
- $classtest->setPageQuery('rootIndex', $_GET['rootIndex']);
- $recordset = $classtest->getRecords();
- ob_start();
- $classtest->showFullFunc();
- $nav = ob_get_contents();
- ob_end_clean();
- $Tp->assign("nav", "$nav");
-
-
- $j = count($recordset);
- $content = "";
- for ($i = 0; $i < $j; $i++) { $temp = Dga($dcfg['name'], "parentid='" . $recordset[$i][id] . "' and del =0");
- $aml = '';
- if (!empty($temp)) {
- if ($_GET['rootIndex']>0){
- $subRootIndex = $_GET['rootIndex']+1;
- }else{
- $subRootIndex = 1;
- }
- $aml = " <a href=\"module.php?op=list&id=" . $recordset[$i][id] . "&rootIndex={$subRootIndex}\" title='?????'><font color=red ><b>_|_</b></font> </a>";
- }
- $content.=" <tr>
- <td height=\"25\" bgColor=#ffffff>" . $recordset[$i]['id'] . "</td>
- <td height=\"25\" bgColor=#ffffff>" . $aml . "" . $recordset[$i]['title'] . "</td>
- <td align=\"middle\" height=\"25\" bgColor=#ffffff>" . $recordset[$i][id] . "</td>
- <td align=\"middle\" width=\"235\" height=\"25\" bgColor=#ffffff>
- ?<a href=\"#\" onclick=\"sortedit('" . $recordset[$i][id] . "')\"><img src='../img/chart_organisation(1).png' title='?????'></a>?|?<a href=\"./module.php?op=del&id=" . $recordset[$i][id] . "\"><img src='../img/chart_organisation_delete.png' title='?????'></a>?|?<a href=\"#\" onclick=\"sortadd('" . $recordset[$i][id] . "')\"><img src='../img/chart_organisation_add.png' title='?????'></a>?</td>
- </tr>";
- }
- $Tp->assign("content", $content);
-
- Ts('module/list.html');
- break; }
- case 'del': {
- $_POST['del'] = 1;
- Du('sevenel', 'sort', $_POST, 'id', $_GET['id'], 0);
- ?>
- <script>
- window.history.back(1);
- </script>
- <?php
- break;
- }
- default: {
- Ts('module/index.html');
- break;
- }
- }
- ?>