예제 #1
0
 public static function getIterAllComponents()
 {
     $dashComp = new DashboardComponent();
     $db = Zend_Registry::get('dbAdapter');
     $enumSelect = $db->select()->from($dashComp->_table)->order('dashboardComponent.name ASC');
     $iter = $dashComp->getIterator($enumSelect);
     $iter->rewind();
     $resarr = array();
     while ($iter->valid()) {
         $item = $iter->current();
         $resarr[] = $item;
         $iter->next();
     }
     return $resarr;
 }
 public function processEditAction()
 {
     $dashboardComponentId = $this->_getParam('dashboardComponentId');
     $field = $this->_getParam('field');
     $value = $this->_getParam('value');
     $dashboardComponent = new DashboardComponent();
     $dashboardComponent->dashboardComponentId = $dashboardComponentId;
     $dashboardComponent->populate();
     $data = array();
     if (in_array($field, $dashboardComponent->ORMFields())) {
         $dashboardComponent->{$field} = $value;
         $dashboardComponent->persist();
         $data['id'] = $dashboardComponent->dashboardComponentId;
         $data['value'] = $dashboardComponent->{$field};
     } else {
         $data['error'] = __('Invalid column') . ': ' . $field;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
 public function getDashComContentAction($dashboardComponentId = 0)
 {
     try {
         $guid = $dashboardComponentId ? $dashboardComponentId : $this->_getParam('guid');
         $dashcom = DashboardComponent::populateWithGUID($guid);
         if (!$dashboardComponentId) {
             $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
             $json->suppressExit = true;
             $json->direct($dashcom);
         } else {
             return $dashcom;
         }
     } catch (Zend_Exception $e) {
         echo "Caught exception: " . get_class($e) . "\n";
         echo "Message: " . $e->getMessage() . "\n";
     }
 }