Exemplo n.º 1
0
 public function __invoke()
 {
     $dbAdapter = $this->serviceLocator->get('DbAdapter');
     $portfolioTable = new PortfolioTable($dbAdapter);
     $portfolios = $portfolioTable->fetchAll()->toArray();
     return $this->getView()->render('partial/promotion', array('portfolios' => $portfolios));
 }
Exemplo n.º 2
0
 public function deletePortfolioAction()
 {
     $this->auth();
     $sm = $this->getServiceLocator();
     $dbAdapter = $sm->get('DbAdapter');
     $request = $this->getRequest();
     $portfolioTable = new PortfolioTable($dbAdapter);
     if ($request->isPost()) {
         $postData = $request->getPost();
         $src = 'public/uploads/portfolio/' . $postData->id;
         $rowset = $portfolioTable->deletePortfolio($postData->id);
         if (!$rowset) {
             $status = 'bad';
         } else {
             $status = 'ok';
         }
         foreach (glob($src . '/*') as $entry) {
             unlink($entry);
         }
     }
     $response = $this->getResponse();
     $answer = array('status' => $status);
     $response->setContent(\Zend\Json\Json::encode($answer));
     $response->getHeaders()->addHeaders(array('Content-Type' => 'application/json'));
     return $response;
 }