コード例 #1
0
ファイル: site_db.php プロジェクト: notzen/ImpressPages-CMS
 public static function getElements($zoneName, $parent, $language, $currentElement, $selectedElement, $order = 'asc', $startFrom = 0, $limit = null, $includeHidden = false)
 {
     $answer = array();
     if ($parent == null) {
         $parent = DbFrontend::getRootElementId($zoneName, $language);
     }
     $sql = "select * from `" . DB_PREF . "content_element` where `parent` = " . (int) $parent . "";
     if (!$includeHidden) {
         $sql .= " and `visible` ";
     }
     $sql .= " order by `row_number` " . $order . " ";
     if ($limit !== null) {
         $sql .= " limit " . (int) $startFrom . ", " . (int) $limit;
     }
     $rs = mysql_query($sql);
     if ($rs) {
         while ($lock = mysql_fetch_assoc($rs)) {
             $answer[] = $lock;
         }
     } else {
         trigger_error($sql . " " . mysql_error());
     }
     return $answer;
 }
コード例 #2
0
ファイル: element.php プロジェクト: notzen/ImpressPages-CMS
 private function generateDepthAndLink()
 {
     global $site;
     $tmpUrlVars = array();
     $tmpId = $this->getId();
     $element = DbFrontend::getElement($tmpId);
     while ($element['parent'] !== null) {
         $tmpUrlVars[] = $element['url'];
         $element = DbFrontend::getElement($element['parent']);
     }
     $languageId = DbFrontend::languageByRootElement($element['id']);
     $urlVars = array();
     for ($i = sizeof($tmpUrlVars) - 1; $i >= 0; $i--) {
         $urlVars[] = $tmpUrlVars[$i];
     }
     $this->depth = sizeof($urlVars);
     switch ($this->type) {
         case 'subpage':
             $tmpChildren = $site->getZone($this->zoneName)->getElements($languageId, $this->id, 0, $limit = 1);
             if (sizeof($tmpChildren) == 1) {
                 $this->link = $tmpChildren[0]->getLink();
             } else {
                 $this->link = $site->generateUrl($languageId, $this->zoneName, $urlVars);
             }
             //open current page if no subpages exist
             break;
         case 'redirect':
             if ($site->managementState()) {
                 if (strpos($this->redirectUrl, BASE_URL) === 0) {
                     if (strpos($this->redirectUrl, 'cms_action=manage') === false) {
                         if (strpos($this->redirectUrl, '?') === false) {
                             $this->redirectUrl .= '?cms_action=manage';
                         } else {
                             $this->redirectUrl .= '&cms_action=manage';
                         }
                     }
                 }
             }
             $this->link = $this->redirectUrl;
             break;
         case 'inactive':
         case 'default':
         default:
             $this->link = $site->generateUrl($languageId, $this->zoneName, $urlVars);
             break;
     }
     $this->linkIgnoreRedirect = $site->generateUrl($languageId, $this->zoneName, $urlVars);
 }