Example #1
0
File: tree.php Project: romlg/cms36
 /**
  * Формирование html-кода для input_treecheck
  */
 function showTreeLinksHtml()
 {
     $ids = get('ids', array(), 'p');
     $fld = get('fld', '', 'p');
     $path_id = get('path', '', 'p');
     $html = "";
     if (!$ids) {
     } else {
         global $site_domains;
         $rows = sql_getRows("SELECT * FROM tree WHERE id IN (" . $ids . ")", true);
         $ids = explode(",", $ids);
         foreach ($ids as $id) {
             $id = (int) trim($id);
             if (!$id) {
                 continue;
             }
             $path = '';
             if (count($site_domains) > 1) {
                 $path .= getSiteByRootID(@$rows[$id]['root_id']) . ' (' . getLangByRootID(@$rows[$id]['root_id']) . '): ';
             }
             $path .= $this->getPath($id, '', '', false);
             $html .= '<div class="textBox">';
             $html .= '<a href="javascript:void(0);" onclick="remove_from_treecheck(\'' . $id . '\', \'' . str_replace(array("[", "]"), array("\\\\[", "\\\\]"), $fld) . '\', this);"><img src="/admin/images/tree/ico_del.gif" style="float:left" alt="Удалить"></a>&nbsp;';
             $html .= $path;
             $html .= '&nbsp;<a href="' . (count($site_domains) > 1 ? 'http://' . getSiteByRootID(@$rows[$id]['root_id']) . '/' . getLangByRootID(@$rows[$id]['root_id']) . $rows[$id]['dir'] . $path_id : @$rows[$id]['dir'] . $path_id) . '" target="_blank"><img src="/admin/images/tree/ico_see.gif" alt="Просмотр"></a>';
             $html .= '</div>';
         }
     }
     echo json_encode(array('html' => iconv('windows-1251', 'utf-8', $html)));
     die;
 }
Example #2
0
 function getMessagesForTemplate()
 {
     $single = true;
     if ($single) {
         $status = sql_getRows('SHOW TABLE STATUS LIKE "sites"');
         if (!empty($status)) {
             if ((int) sql_getValue('SELECT COUNT(*) FROM sites') > 1) {
                 $single = false;
             }
         }
     }
     if ($single) {
         $status = sql_getRows('SHOW TABLE STATUS LIKE "sites_langs"');
         if (!empty($status)) {
             if ((int) sql_getValue('SELECT COUNT(*) FROM sites_langs') > 1) {
                 $single = false;
             }
         }
     }
     if (!$single) {
         $row = sql_getRows("\n            SELECT\n                IF(t2.value IS NULL, IF(t1.module='site', t1.name, CONCAT(t1.module,'_',t1.name)), IF(t2.module='site', t2.name, CONCAT(t2.module,'_',t2.name))) AS name,\n                IFNULL(t2.value,t1.value) AS value\n            FROM strings AS t1\n            LEFT JOIN strings AS t2 ON (t1.module=t2.module AND t1.name=t2.name AND t2.lang='" . lang() . "' AND t2.root_id='" . ROOT_ID . "')\n            WHERE t1.lang='" . getLangByRootID(getMainRootID()) . "' AND t1.root_id='" . getMainRootID() . "'\n            ORDER BY IFNULL(t2.module,t1.module) ASC", true);
         return $row;
     }
     $row = sql_getRows("SELECT IF(module='site',name, CONCAT(module,'_',name)) AS name, value FROM strings WHERE lang='" . lang() . "' AND root_id='" . ROOT_ID . "' ORDER BY module ASC", true);
     return $row;
 }