コード例 #1
0
ファイル: Slider.php プロジェクト: kizz66/meat
 public function edit()
 {
     $this->show->error = '';
     if ($this->show->itemID) {
         $this->show->item = Slider::getById($this->show->itemID);
         if (!$this->show->item) {
             redirect(BASE_PATH . self::PATH);
         }
         $this->show->breadcrumbs[] = array('url' => BASE_PATH . self::PATH . $this->show->itemID . '/edit', 'title' => $this->show->item->id);
     } else {
         $this->show->breadcrumbs[] = array('url' => BASE_PATH . self::PATH . '/0/edit', 'title' => 'Создание');
     }
     if (!empty($this->post['Save'])) {
         if ($this->show->itemID) {
             $result = Slider::update($this->post);
             if ($result != 'ok') {
                 $this->show->error = $result;
             } else {
                 redirect(BASE_PATH . self::PATH);
             }
         } else {
             $result = Slider::insert($this->post);
             if ($result != 'ok') {
                 $this->show->error = $result;
             } else {
                 redirect(BASE_PATH . self::PATH);
             }
         }
     }
 }