Exemplo n.º 1
0
 public function get()
 {
     if ($this->hasParameter("id")) {
         return array("data" => PartManager::getInstance()->getPart($this->getParameter("id"))->serialize());
     } else {
         $filter = new ManagerFilter($this);
         $filter->setFilterCallback(array($this, "filterCallback"));
         return PartManager::getInstance()->getList($filter);
     }
 }
Exemplo n.º 2
0
 /**
  * (non-PHPdoc)
  * @see PartKeepr\Service.RestfulService::get()
  */
 public function get()
 {
     if ($this->hasParameter("id")) {
         return array("data" => SystemNoticeManager::getInstance()->getEntity($this->getParameter("id"))->serialize());
     } else {
         $parameters = new ManagerFilter($this);
         $parameters->setFilterCallback(array($this, "filterCallback"));
         return SystemNoticeManager::getInstance()->getList($parameters);
     }
 }
Exemplo n.º 3
0
 /**
  * (non-PHPdoc)
  * @see \PartKeepr\Service\RestfulService::get()
  */
 public function get()
 {
     if ($this->hasParameter("id")) {
         $job = PrintingJobManager::getInstance()->getEntity($this->getParameter("id"));
         $this->checkPermission($job);
         return array("data" => $job->serialize());
     } else {
         $filter = new ManagerFilter($this);
         $filter->setFilterCallback(array($this, "filterCallback"));
         return PrintingJobManager::getInstance()->getList($filter);
     }
 }
Exemplo n.º 4
0
 /**
  * Implements the get() call for the RestfulService.
  * 
  * If the "id" parameter is passed, try to return the user by id. If not,
  * return a list.
  * 
  * @see PartKeepr\Service.RestfulService::get()
  */
 public function get()
 {
     if ($this->hasParameter("id")) {
         if (!SessionManager::getCurrentSession()->getUser()->isAdmin()) {
             throw new \Exception("Permission denied");
         }
         return array("data" => UserManager::getInstance()->getUser($this->getParameter("id"))->serialize());
     } else {
         $filter = new ManagerFilter($this);
         $filter->setFilterCallback(array($this, "filterCallback"));
         return UserManager::getInstance()->getList($filter);
     }
 }
Exemplo n.º 5
0
 /**
  * (non-PHPdoc)
  * @see PartKeepr\Service.RestfulService::get()
  */
 public function get()
 {
     if ($this->hasParameter("id")) {
         return array("data" => StockManager::getInstance()->getEntity($this->getParameter("id"))->serialize());
     } else {
         $parameters = new ManagerFilter($this);
         $parameters->setFilterField("name");
         if ($this->hasParameter("part")) {
             $parameters->setFilterCallback(array($this, "filterCallback"));
         }
         return StockManager::getInstance()->getList($parameters);
     }
 }