Ejemplo n.º 1
0
 /**
  * Get material by url
  * @param $url
  * @return mixed
  */
 public function getMaterialByUrl($url)
 {
     if (empty($url)) {
         return null;
     }
     // If this material located in cache then return it
     if (isset($this->materialByUrlCache[$url])) {
         return $this->materialByUrlCache[$url];
     }
     $result = $this->query->className('samson\\cms\\CMSMaterial')->cond('Url', $url)->first();
     $this->materialByUrlCache[$url] = $result;
     return $result;
 }
Ejemplo n.º 2
0
Archivo: Core.php Proyecto: onysko/seo
 /**
  * Add dynamic tags into specific material
  * @param $materialId
  * @param $structureId
  */
 public function addDynamicTags($materialId, $structureId)
 {
     $dynamicSchema = new Dynamic();
     if ($structureId == $dynamicSchema->getStructureId()) {
         // If binding material and structure don't exists then create it
         if ($this->query->className('structurematerial')->cond('StructureID', $structureId)->cond('MaterialID', $materialId)->count() == 0) {
             // Create relations
             $sm = new structurematerial(false);
             $sm->StructureID = $structureId;
             $sm->MaterialID = $materialId;
             $sm->save();
             // Add row
             m('material_table')->__async_add($materialId, $structureId);
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Get material by url
  * @param $url
  * @return mixed
  */
 public function getMaterialByUrl($url)
 {
     return $this->query->className('samson\\cms\\CMSMaterial')->Url($url)->first();
 }
Ejemplo n.º 4
0
 /**
  * Get field if exists
  * @param $fieldId
  * @param $structureId
  * @return mixed
  */
 public function isFieldAssigned($fieldId, $structureId)
 {
     return $this->query->className('structurefield')->cond('FieldID', $fieldId)->cond('StructureID', $structureId)->first();
 }
Ejemplo n.º 5
0
 /**
  * Get structure if exists
  * @param $name
  * @param $url
  * @return mixed
  */
 public function isStructureExists($name, $url)
 {
     return $this->query->className('\\samson\\cms\\Navigation')->cond('Name', $name)->cond('Url', $url)->first();
 }