예제 #1
0
 /**
  * @param  Element_Interface $element
  * @return void
  */
 public function getApiElement($element)
 {
     $service = new Webservice_Service();
     if ($element instanceof Object_Folder) {
         return $service->getObjectFolderById($element->getId());
     } else {
         if ($element instanceof Object_Concrete) {
             return $service->getObjectConcreteById($element->getId());
         } else {
             if ($element instanceof Asset_Folder) {
                 return $service->getAssetFolderById($element->getId());
             } else {
                 if ($element instanceof Asset) {
                     return $service->getAssetFileById($element->getId());
                 } else {
                     if ($element instanceof Document_Folder) {
                         return $service->getDocumentFolderById($element->getId());
                     } else {
                         if ($element instanceof Document_Snippet) {
                             return $service->getDocumentSnippetById($element->getId());
                         } else {
                             if ($element instanceof Document_Page) {
                                 return $service->getDocumentPageById($element->getId());
                             } else {
                                 if ($element instanceof Document_Link) {
                                     return $service->getDocumentLinkById($element->getId());
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
예제 #2
0
 /**
  * @param  Element_Interface $webResource
  * @return void
  */
 public function __construct($webResource)
 {
     $this->id = $webResource->getId();
     if ($webResource instanceof Element_Interface) {
         $this->type = Element_Service::getType($webResource);
     } else {
         $this->type = "unknown";
     }
 }
예제 #3
0
 /**
  * @param  Element_Interface $element
  * @return void
  */
 public function getForElement($element)
 {
     try {
         if ($element instanceof Document) {
             $maintype = "document";
         } else {
             if ($element instanceof Asset) {
                 $maintype = "asset";
             } else {
                 if ($element instanceof Object_Abstract) {
                     $maintype = "object";
                 } else {
                     throw Exception("unknown type of element with id [ " . $element->getId() . " ] ");
                 }
             }
         }
         $data = $this->db->fetchRow("SELECT * FROM search_backend_data WHERE id= ? AND maintype = ? ", array($element->getId(), $maintype));
         if (is_array($data)) {
             $this->assignVariablesToModel($data);
             $this->model->setId(new Search_Backend_Data_Id($element));
         }
     } catch (Exception $e) {
     }
 }
예제 #4
0
파일: Id.php 프로젝트: ngocanh/pimcore
 /**
  * @param  Element_Interface $webResource
  * @return void
  */
 public function __construct($webResource)
 {
     $this->id = $webResource->getId();
     if ($webResource instanceof Document) {
         $this->type = "document";
     } else {
         if ($webResource instanceof Asset) {
             $this->type = "asset";
         } else {
             if ($webResource instanceof Object_Abstract) {
                 $this->type = "object";
             } else {
                 $this->type = "unknown";
             }
         }
     }
 }
예제 #5
0
 public static function trackElement(Element_Interface $element)
 {
     $type = "";
     if ($element instanceof Document) {
         $type = "document";
     } else {
         if ($element instanceof Asset) {
             $type = "asset";
         } else {
             if ($element instanceof Object_Abstract) {
                 $type = "object";
             } else {
                 return;
             }
         }
     }
     self::trackPageView('/pimcoreanalytics/' . $type . '/' . $element->getId());
     return true;
 }
예제 #6
0
 /**
  * Clear all relations in the database
  * @param Element_Interface $element
  */
 public function clearAllForElement($element)
 {
     try {
         $id = $element->getId();
         $type = Element_Service::getElementType($element);
         //schedule for sanity check
         $data = $this->db->fetchAll("SELECT * FROM dependencies WHERE targetid = ? AND targettype = ?", array($id, $type));
         if (is_array($data)) {
             foreach ($data as $row) {
                 $sanityCheck = new Element_Sanitycheck();
                 $sanityCheck->setId($row['sourceid']);
                 $sanityCheck->setType($row['sourcetype']);
                 $sanityCheck->save();
             }
         }
         $this->db->delete("dependencies", $this->db->quoteInto("sourceid = ?", $id) . " AND " . $this->db->quoteInto("sourcetype = ?", $type));
         $this->db->delete("dependencies", $this->db->quoteInto("targetid = ?", $id) . " AND " . $this->db->quoteInto("targettype = ?", $type));
     } catch (Exception $e) {
         Logger::error($e);
     }
 }
예제 #7
0
파일: Service.php 프로젝트: ngocanh/pimcore
 /**
  * @param  Element_interface $element
  * @return array
  */
 public static function gridElementData(Element_Interface $element)
 {
     $data = array("id" => $element->getId(), "fullpath" => $element->getFullPath(), "type" => Element_Service::getType($element), "subtype" => $element->getType(), "filename" => self::getFilename($element), "creationDate" => $element->getCreationDate(), "modificationDate" => $element->getModificationDate());
     if (method_exists($element, "isPublished")) {
         $data["published"] = $element->isPublished();
     } else {
         $data["published"] = true;
     }
     return $data;
 }
예제 #8
0
 /**
  * @param Element_Interface $element
  */
 public function setElement(Element_Interface $element)
 {
     $this->setCid($element->getId());
     $this->setCtype(Element_Service::getType($element));
 }