Ejemplo n.º 1
0
 public function cachedImages()
 {
     $query = "slider_id = {$this->id}";
     $key = HOST_HASH . md5("Slider::cachedImages({$this->id})");
     $images = SliderImage::find(array($query, 'order' => 'sortorder ASC', 'cache' => array('key' => $key, 'lifetime' => 60)));
     return $images;
 }
Ejemplo n.º 2
0
 public function saveSliderAction()
 {
     $slider_id = $this->request->getPost('slider', 'int');
     $this->view->cleanTemplateBefore();
     $itemsData = $this->request->getPost('items');
     if (count($itemsData)) {
         foreach ($itemsData as $k => $v) {
             $imageModel = Image::findFirst('id = ' . $k . ' AND slider_id = ' . $slider_id);
             $imageModel->setSortOrder($v['sort']);
             $imageModel->setCaption($v['text']);
             $imageModel->setLink($v['link']);
             $imageModel->update();
         }
     }
     $this->response->setHeader('Content-Type', 'text/plain');
     $this->response->setContentType('application/json', 'UTF-8');
     $this->response->setStatusCode(200, 'OK');
     $this->response->setContent(json_encode($this->request->getPost()));
     $this->view->disable();
     echo '1';
     return;
     return $this->response;
 }