Exemplo n.º 1
0
 public function _new($followup = FALSE)
 {
     if (array_key_exists('followup', $this->_data)) {
         $followup = $this->_data['followup'];
     }
     $this->view->set('page_title', 'New CRM Activity');
     // New follow-up activity
     if ($followup) {
         $this->view->set('page_title', 'New CRM Follow-up Activity');
         unset($this->_data['id']);
         $activity = new Activity();
         $activity->load($followup);
         $this->_data['person_id'] = $activity->person_id;
         $this->_data['company_id'] = $activity->company_id;
         $this->_data['name'] = $activity->name;
         $this->_data['description'] = $activity->description;
         $this->_data['completed'] = '';
     }
     // Edit existing activity
     if (isset($this->_data['id'])) {
         $this->view->set('page_title', 'Edit CRM Activity');
     }
     // New activity from opportunity
     if (isset($this->_data['opportunity_id'])) {
         $this->view->set('page_title', 'New CRM Activity');
         $opportunity = DataObjectFactory::Factory('Opportunity');
         $opportunity->load($this->_data['opportunity_id']);
         $this->_data['person_id'] = $opportunity->person_id;
         $this->_data['company_id'] = $opportunity->company_id;
     }
     parent::_new();
 }
 /**
  * load in the Activities for the given SQL statement
  *
  * @param string $sql
  * @param array $params the parameters that go into the sql statement
  * @param String $style (optional - default 'long') may be 'short' or 'long' or 'cif'
  * @return ActivitySet (this)
  */
 function load($sql, $params, $style = 'long')
 {
     global $DB;
     if (!isset($params)) {
         $params = array();
     }
     // get records
     $resArray = $DB->select($sql, $params);
     if ($resArray !== false) {
         $count = count($resArray);
         for ($i = 0; $i < $count; $i++) {
             $array = $resArray[$i];
             $a = new Activity();
             $xml = $array['XML'];
             $activity = $a->load($array['ItemID'], $array['UserID'], $array['Type'], $array['ModificationDate'], $array['ChangeType'], $xml, $style);
             if (!$activity instanceof Error) {
                 $this->add($a);
             }
         }
         $this->totalno = count($this->activities);
     } else {
         return database_error();
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * 根据name和id返回建筑的引用。这个函数的动作由,读,获取引用,快照
  *
  * @var $name	建筑的名字
  * @var $oid	建筑的id
  * 
  * @return object building的引用
  */
 private function getObject($name, $oid)
 {
     //------------------------
     //step1:读出建筑
     $old_data = $this->readObject($name, $oid);
     //------------------------
     //step2:对建筑做快照
     switch ($name) {
         case 'storage':
             $object = new Storage();
             break;
         case 'building':
             $object = new Building();
             break;
         case 'activity':
             $object = new Activity();
             break;
         default:
             echo 'error: bad name' . $name;
     }
     $object->load($old_data);
     //-----------------
     //step3:返回建筑引用
     return $object;
 }