Пример #1
0
 public function slider($id)
 {
     $slider = \Slider\Model\Slider::findCachedById($id);
     if ($slider && count($slider->cachedImages())) {
         $view = clone $this->getDI()->get('view');
         $view->start();
         $view->partial('main/slider/base', array('slider' => $slider));
         $html = ob_get_contents();
         $view->finish();
     } else {
         $html = '';
     }
     return $html;
 }
Пример #2
0
 public function masterstatusAction()
 {
     $status_id = (int) $this->params()->fromRoute('id', 0);
     $status = (int) $this->params()->fromRoute('status', 0);
     if ($status == 1) {
         $data = array('id' => $status_id, 'status' => '0');
     } else {
         $data = array('id' => $status_id, 'status' => '1');
     }
     //print_r($data);
     $TagModel = new Slider();
     $TagModel->exchangeArray($data);
     $this->getSliderTable()->changeStatus($TagModel);
     $this->redirect()->toUrl(WEBPATH . '/tags/masterindex');
     //           die;
     //		if ($status_id == 0) {
     //			return $this->redirect ()->toRoute ( 'Slider' );
     //		}
 }
Пример #3
0
 public function deleteImageAction()
 {
     $id = $this->request->getPost('id', 'int');
     $this->view->cleanTemplateBefore();
     $model = Image::findFirst(array('id = ' . $id));
     $slider_id = $model->getSliderId();
     if ($model) {
         $imageFilter = new \Image\Filter(array('id' => $id, 'type' => 'slider'));
         $imageFilter->remove(true);
         $entity = Slider::findFirst('id = ' . $model->getSliderId());
         if ($model->delete()) {
             $result = true;
         } else {
             $result = false;
         }
     } else {
         $result = false;
     }
     $this->response->setHeader('Content-Type', 'text/plain');
     $this->response->setContentType('application/json', 'UTF-8');
     $this->response->setStatusCode(200, 'OK');
     $this->response->setContent(json_encode($result));
     $this->view->disable();
     echo !!$result;
     return $this->response;
 }