コード例 #1
0
ファイル: PackageMgt.php プロジェクト: baiooy/hqimt_backend
 public static function fetchAll($where = null, $order = null, $limit = null, $offset = null)
 {
     $resultSet = self::getDbTable()->fetchAll($where, $order, $limit, $offset);
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new Application_Model_O_PackageMgt();
         $entry->setId($row->id)->setName($row->name)->setDescription($row->description)->setVersion($row->version)->setPlatform($row->platform)->setUrl($row->url)->setCtime($row->ctime)->setUtime($row->utime)->setStatus($row->status);
         $entry->setNew(false);
         $entries[] = $entry;
     }
     return $entries;
 }
コード例 #2
0
ファイル: PackageMgt.php プロジェクト: baiooy/hqimt_backend
 public static function fetchByPlatformPage($os = NULL, $page = 1, $perpage = 30)
 {
     $select = self::select();
     $select->order('version desc');
     if ($os) {
         $select->where('platform = ?', $os);
     }
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $packages = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $packageModel = new Application_Model_O_PackageMgt();
             $packageModel->setId($da->id)->setName($da->name)->setDescription($da->description)->setVersion($da->version)->setPlatform($da->platform)->setUrl($da->url)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($packages, $packageModel);
         }
     }
     $res = array('packages' => $packages, 'pages' => $pages);
     return $res;
 }
コード例 #3
0
 public function asyncajaxAction()
 {
     $this->getResponse()->setHeader('Content-Type', 'application/json');
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $params = $this->_getAllParams();
     //echo "<pre>";var_dump($params);exit;
     $package = new Application_Model_O_PackageMgt();
     $validate = new Yy_Validate_Value();
     if ($validate->isValid($params['id'])) {
         $package->setId($params['id']);
     } else {
         $package->setCtime(date('Y-m-d H:i:s'));
     }
     if ($validate->isValid($params['name'])) {
         $package->setName($params['name']);
     }
     if ($validate->isValid($params['description'])) {
         $package->setDescription($params['description']);
     }
     if ($validate->isValid($params['version'])) {
         $package->setVersion($params['version']);
     }
     if ($validate->isValid($params['platform'])) {
         $package->setPlatform($params['platform']);
     }
     if ($validate->isValid($params['url'])) {
         $package->setUrl($params['url']);
     }
     if ($validate->isValid($params['status'])) {
         $package->setStatus($params['status']);
     }
     try {
         $package->save();
         $id = $package->getId();
         $url = '/package/view?id=' . $id;
         $this->redirect($url);
     } catch (Zend_Db_Exception $e) {
         $this->redirect('/error?message=' . $e->getMessage());
     }
 }