Exemplo n.º 1
0
 public function deleteAction()
 {
     $id = $this->_getParam('id');
     $model = new Application_Model_Widgets();
     $widgetRes = $model->find($id);
     if ($widgetRes) {
         $model->delete("id={$id}");
         //unlink image if files exists
         if (file_exists("media/picture/home/" . $widgetRes->getWidgetImage())) {
             unlink("media/picture/home/" . $widgetRes->getWidgetImage());
             unlink("media/picture/home/thumb_" . $widgetRes->getWidgetImage());
         }
         $_SESSION['errorMsg'] = "Slide has been deleted!";
     } else {
         $_SESSION['errorMsg'] = "Invalid request, no slide found.";
     }
     return $this->_helper->redirector('index', 'widgets', "admin");
 }
Exemplo n.º 2
0
 private function setModel($row)
 {
     $model = new Application_Model_Widgets();
     $model->setId($row->id)->setWidgetTitle($row->widget_title)->setWidgetType($row->widget_type)->setWidgetImage($row->widget_image)->setWidgetText($row->widget_text)->setWidgetAltText($row->widget_alt_text)->setWidgetLinkLabel($row->widget_link_label)->setWidgetLinkUrl($row->widget_link_url)->setWidgetLinkTarget($row->widget_link_target)->setWidgetDesc($row->widget_desc)->setWeight($row->weight)->setStatus($row->status)->setUserId($row->user_id)->setAddedon($row->addedon)->setUpdatedon($row->updatedon);
     return $model;
 }