コード例 #1
0
 public function insert(Label $O_label)
 {
     if (!is_null($O_label->getLabel() && $O_label->getModel() && $O_label->getReference() && $O_label->getDescription() && $O_label->getLifeTime() && $O_label->getControlCycle() && $O_label->getNotice() && $O_label->getProcedure() && $O_label->getImage() && $O_label->getSize() && $O_label->getColor() && $O_label->getCategoryEpiId())) {
         var_dump($O_label);
         $S_label = $O_label->getLabel();
         $S_model = $O_label->getModel();
         $S_reference = $O_label->getReference();
         $S_description = $O_label->getDescription();
         $I_lifeTime = $O_label->getLifeTime();
         $I_controleCycle = $O_label->getControlCycle();
         $S_notice = $O_label->getNotice();
         $S_procedure = $O_label->getProcedure();
         $S_image = $O_label->getImage();
         $S_size = $O_label->getSize();
         $S_color = $O_label->getColor();
         $I_categoryEpiId = $O_label->getCategoryEpiId();
         $S_sql = 'INSERT INTO `label_epi` (`label`, `model`, `reference`, `description`, `lifetime`, `control_cycle`, `notice`, `procedure`, `image`, `size`, `color`, `category_epi_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
         $A_params = array($S_label, $S_model, $S_reference, $S_description, $I_lifeTime, $I_controleCycle, $S_notice, $S_procedure, $S_image, $S_size, $S_color, $I_categoryEpiId);
         $O_connection = new Connection();
         if ($I_labelId = $O_connection->requestDb($S_sql, $A_params)) {
             return $I_labelId;
         } else {
             throw new Exception("Des informations obligatoires sont manquantes, nous ne pouvons pas créer le modèle");
         }
     }
 }
コード例 #2
0
ファイル: Aktual.php プロジェクト: jager/cms
 public function updateActual($aData)
 {
     if (isset($aData['id'])) {
         $this->id = $aData['id'];
         $this->edited = new Doctrine_Expression('NOW()');
     } else {
         $this->created = new Doctrine_Expression('NOW()');
         $this->edited = new Doctrine_Expression('NOW()');
     }
     $aTags = Tag::checkTags(Tag::makeTags($aData['tags']));
     $this->title = $aData['title'];
     $this->shortcontent = trim(stripslashes($aData['shortcontent']));
     $this->fullcontent = trim(stripslashes($aData['fullcontent']));
     $this->tags = $aData['tags'];
     $this->active = $aData['active'];
     $this->link = Webbers_Normalize::Link($aData['title']);
     $this->AktualsTags->delete();
     $this->AktualsLabels->delete();
     $this->save();
     if (sizeof($aTags) > 0) {
         foreach ($aTags as $tag) {
             $aktualTags = new AktualsTag();
             $aktualTags->Aktuals_id = $this->id;
             $aktualTags->Tags_id = $tag->id;
             $aktualTags->save();
         }
     }
     $labels = array();
     if (isset($aData['newlabel']) and $aData['newlabel'] != '') {
         $newLabel = Webbers_Normalize::Name($aData['newlabel']);
         $label = Label::getLabel($newLabel);
         if ($label != false) {
             $labelID = $label->id;
         } else {
             $label = new Label();
             $label->Gname = $newLabel;
             $label->save();
             $labelID = $label->getIncremented();
         }
         $labels = array($labelID);
     }
     if (isset($aData['labels']) and sizeof($aData['labels']) > 0) {
         $labels = array_unique(array_merge($aData['labels'], $labels));
         foreach ($labels as $lab) {
             $al = new AktualsLabel();
             $al->Labels_id = $lab;
             $al->Aktuals_id = $this->id;
             $al->save();
         }
     }
     return $this->id;
 }