Beispiel #1
0
 /**
  * Ajout d'un produit
  *
  * @param cursor $cursor
  * @return integer
  */
 public function addProd($cursor)
 {
     # ajout dans la DB
     $cursor->created_at = date('Y-m-d H:i:s');
     $cursor->content = $this->okt->HTMLfilter($cursor->content);
     $cursor->words = implode(' ', array_unique(text::splitWords($cursor->title . ' ' . $cursor->subtitle . ' ' . $cursor->content_short . ' ' . $cursor->content)));
     if (!$cursor->insert()) {
         return false;
     }
     # récupération de l'ID
     $iNewId = $this->db->getLastID();
     # modification du slug
     if ($this->setProdSlug($iNewId) === false) {
         return false;
     }
     # ajout des images
     if ($this->config->images['enable'] && $this->addImages($iNewId) === false) {
         return false;
     }
     # ajout des fichiers
     if ($this->config->files['enable'] && $this->addFiles($iNewId) === false) {
         return false;
     }
     return $iNewId;
 }
 /**
  * Ajout d'un élément.
  *
  * @param cursor $oCursor
  * @param array $aItemLocalesData
  * @return integer
  */
 public function addItem($oCursor, $aItemLocalesData)
 {
     $sDate = date('Y-m-d H:i:s');
     $oCursor->created_at = $sDate;
     $oCursor->updated_at = $sDate;
     if (!$oCursor->insert()) {
         throw new Exception('Unable to insert item into database');
     }
     # récupération de l'ID
     $iNewId = $this->db->getLastID();
     # ajout des textes internationnalisés
     $this->setItemI18n($iNewId, $aItemLocalesData);
     # ajout des images
     if ($this->config->images['enable'] && $this->addImage($iNewId) === false) {
         throw new Exception('Unable to insert images item');
     }
     return $iNewId;
 }
Beispiel #3
0
 /**
  * Ajout d'un évènement
  *
  * @param cursor $oCursor
  * @return integer
  */
 public function addEvent($oCursor)
 {
     $date = date('Y-m-d H:i:s');
     $oCursor->created_at = $date;
     $oCursor->updated_at = $date;
     $oCursor->date = mysql::formatDateTime($oCursor->date);
     if ($oCursor->date_end != '') {
         $oCursor->date_end = mysql::formatDateTime($oCursor->date_end);
     } else {
         $oCursor->date_end = null;
     }
     $oCursor->description = $this->okt->HTMLfilter($oCursor->description);
     $oCursor->disponibility = $oCursor->disponibility;
     $oCursor->meta_description = html::clean($oCursor->meta_description);
     $oCursor->meta_keywords = html::clean($oCursor->meta_keywords);
     if (!$oCursor->insert()) {
         return false;
     }
     # récupération de l'ID
     $iNewId = $this->db->getLastID();
     # ajout des images
     if ($this->config->images['enable'] && $this->addImages($iNewId) === false) {
         return false;
     }
     # ajout des fichiers
     if ($this->config->files['enable'] && $this->addFiles($iNewId) === false) {
         return false;
     }
     # création du slug
     if ($this->setEventSlug($iNewId) === false) {
         return false;
     }
     return $iNewId;
 }
Beispiel #4
0
 /**
  * Ajout d'une page.
  *
  * @param cursor $oCursor
  * @param array $aPageLocalesData
  * @param array $aPagePermsData
  * @return integer
  */
 public function addPage($oCursor, $aPageLocalesData, $aPagePermsData)
 {
     $sDate = date('Y-m-d H:i:s');
     $oCursor->created_at = $sDate;
     $oCursor->updated_at = $sDate;
     if (!$oCursor->insert()) {
         throw new Exception('Unable to insert page into database');
     }
     # récupération de l'ID
     $iNewId = $this->db->getLastID();
     # ajout des textes internationnalisés
     $this->setPageI18n($iNewId, $aPageLocalesData);
     # ajout des images
     if ($this->config->images['enable'] && $this->addImages($iNewId) === false) {
         throw new Exception('Unable to insert images page');
     }
     # ajout des fichiers
     if ($this->config->files['enable'] && $this->addFiles($iNewId) === false) {
         throw new Exception('Unable to insert files page');
     }
     # ajout permissions
     if (!$this->setPagePermissions($iNewId, !empty($aPagePermsData) ? $aPagePermsData : array())) {
         throw new Exception('Unable to set page permissions');
     }
     return $iNewId;
 }
 /**
  * Ajout d'une rubrique.
  *
  * @param cursor $oCursor
  * @param ArrayObject $aCategoryLocalesData
  * @return integer
  */
 public function addCategory($oCursor, $aCategoryLocalesData)
 {
     $iMaxOrder = $this->numChildren($oCursor->parent_id);
     $oCursor->ord = $iMaxOrder + 1;
     if ($oCursor->parent_id > 0) {
         $rsParent = $this->getCategory($oCursor->parent_id);
         if ($rsParent->active == 0) {
             $oCursor->active = 0;
         }
     }
     if (!$oCursor->insert()) {
         throw new Exception('Unable to insert category in database.');
     }
     $iNewId = $this->db->getLastID();
     $this->setCategoryI18n($iNewId, $aCategoryLocalesData);
     $this->rebuild();
     return $iNewId;
 }
Beispiel #6
0
 /**
  * Ajout d'un jeu d'images.
  *
  * @param cursor $oCursor
  * @return integer
  */
 public function addImagesSet($oCursor)
 {
     if (!$oCursor->insert()) {
         throw new Exception('Unable to insert images set into database');
     }
     # récupération de l'ID
     $iNewId = $this->db->getLastID();
     # ajout des images
     if ($this->addImages($iNewId) === false) {
         throw new Exception('Unable to insert images of images set');
     }
     return $iNewId;
 }
 /**
  * Ajout d'une galerie.
  *
  * @param cursor $oCursor
  * @param ArrayObject $aGalleryLocalesData
  * @return integer
  */
 public function addGallery($oCursor, $aGalleryLocalesData)
 {
     $iMaxOrder = $this->numChildren($oCursor->parent_id);
     $oCursor->ord = $iMaxOrder + 1;
     if ($oCursor->parent_id > 0) {
         $rsParent = $this->getGallery($oCursor->parent_id);
         if ($rsParent->active == 0) {
             $oCursor->active = 0;
         }
     }
     $sDate = date('Y-m-d H:i:s');
     $oCursor->created_at = $sDate;
     $oCursor->updated_at = $sDate;
     if (!$oCursor->insert()) {
         throw new Exception('Unable to insert gallery in database.');
     }
     $iNewId = $this->db->getLastID();
     $this->setGalleryI18n($iNewId, $aGalleryLocalesData);
     $this->rebuild();
     if (!$this->addImage($iNewId)) {
         return false;
     }
     return $iNewId;
 }