Example #1
0
 public function loadFromDatabase()
 {
     if (!isset($this->fields)) {
         //From down to up
         $select = array_values($this->fieldMap);
         $this->dbPath = array();
         $id = $this->id;
         while ($id > 0) {
             $sectionList = \Freetrix\Iblock\SectionTable::getList(array("select" => $select, "filter" => array("=ID" => $id)));
             $section = $sectionList->fetch();
             if ($section) {
                 $this->dbPath[] = $section;
             } else {
                 break;
             }
             $id = $section["IBLOCK_SECTION_ID"];
         }
         //Reversed from up to down
         //and laid by fields
         $this->fields = array();
         for ($i = count($this->dbPath) - 1; $i >= 0; $i--) {
             foreach ($this->dbPath[$i] as $fieldName => $fieldValue) {
                 $this->fields[$fieldName][] = $fieldValue;
             }
         }
         $this->loadProperty();
     }
     return is_array($this->fields);
 }
Example #2
0
 function clearValues()
 {
     $connection = \Freetrix\Main\Application::getConnection();
     $sectionList = \Freetrix\Iblock\SectionTable::getList(array("select" => array("LEFT_MARGIN", "RIGHT_MARGIN"), "filter" => array("=ID" => $this->section_id)));
     $section = $sectionList->fetch();
     if ($section) {
         $connection->query("\n\t\t\t\tDELETE FROM b_iblock_element_iprop\n\t\t\t\tWHERE IBLOCK_ID = " . $this->iblock_id . "\n\t\t\t\tAND ELEMENT_ID in (\n\t\t\t\t\tSELECT BSE.IBLOCK_ELEMENT_ID\n\t\t\t\t\tFROM b_iblock_section_element BSE\n\t\t\t\t\tINNER JOIN b_iblock_section BS ON BSE.IBLOCK_SECTION_ID = BS.ID AND BSE.ADDITIONAL_PROPERTY_ID IS NULL\n\t\t\t\t\tWHERE BS.IBLOCK_ID = " . $this->iblock_id . "\n\t\t\t\t\tAND BS.LEFT_MARGIN <= " . $section["RIGHT_MARGIN"] . "\n\t\t\t\t\tAND BS.RIGHT_MARGIN >= " . $section["LEFT_MARGIN"] . "\n\t\t\t\t)\n\t\t\t");
         $connection->query("\n\t\t\t\tDELETE FROM b_iblock_section_iprop\n\t\t\t\tWHERE IBLOCK_ID = " . $this->iblock_id . "\n\t\t\t\tAND SECTION_ID in (\n\t\t\t\t\tSELECT BS.ID\n\t\t\t\t\tFROM b_iblock_section BS\n\t\t\t\t\tWHERE BS.IBLOCK_ID = " . $this->iblock_id . "\n\t\t\t\t\tAND BS.LEFT_MARGIN <= " . $section["RIGHT_MARGIN"] . "\n\t\t\t\t\tAND BS.RIGHT_MARGIN >= " . $section["LEFT_MARGIN"] . "\n\t\t\t\t)\n\t\t\t");
     }
 }
Example #3
0
 protected function load()
 {
     $sectionList = \Freetrix\Iblock\SectionTable::getList(array("select" => array("NAME"), "filter" => array("=ID" => $this->key)));
     $section = $sectionList->fetch();
     if ($section) {
         return $section["NAME"];
     } else {
         return "";
     }
 }
Example #4
0
 protected function loadFromDatabase()
 {
     if (!isset($this->fields)) {
         $sectionList = \Freetrix\Iblock\SectionTable::getList(array("select" => array_values($this->fieldMap), "filter" => array("=ID" => $this->id)));
         $this->fields = $sectionList->fetch();
     }
     return is_array($this->fields);
 }