コード例 #1
0
ファイル: Accounts.php プロジェクト: netconstructor/X2Engine
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $fields = Fields::model()->findAllByAttributes(array('modelName' => 'Accounts'));
     foreach ($fields as $field) {
         $fieldName = $field->fieldName;
         switch ($field->type) {
             case 'boolean':
                 $criteria->compare($field->fieldName, $this->compareBoolean($this->{$fieldName}), true);
                 break;
             case 'link':
                 $criteria->compare($field->fieldName, $this->compareLookup($field, $this->{$fieldName}), true);
                 break;
             case 'assignment':
                 $criteria->compare($field->fieldName, $this->compareAssignment($this->{$fieldName}), true);
                 break;
             default:
                 $criteria->compare($field->fieldName, $this->{$fieldName}, true);
         }
     }
     $dataProvider = new SmartDataProvider(get_class($this), array('sort' => array('defaultOrder' => 'name ASC'), 'pagination' => array('pageSize' => ProfileChild::getResultsPerPage()), 'criteria' => $criteria));
     $arr = $dataProvider->getData();
     foreach ($arr as $account) {
         $account->assignedTo = User::getUserLinks($account->assignedTo);
         $account->associatedContacts = Contacts::getContactLinks($account->associatedContacts);
     }
     $dataProvider->setData($arr);
     return $dataProvider;
 }
コード例 #2
0
ファイル: AccountChild.php プロジェクト: ruchida/X2Engine
	public function search() {
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('website',$this->website,true);
		$criteria->compare('type',$this->type,true);
		$criteria->compare('annualRevenue',$this->annualRevenue);
		$criteria->compare('phone',$this->phone,true);
		$criteria->compare('tickerSymbol',$this->tickerSymbol,true);
		$criteria->compare('employees',$this->employees);
		$criteria->compare('assignedTo',$this->assignedTo,true);
		$criteria->compare('associatedContacts',$this->associatedContacts,true);
		$criteria->compare('description',$this->description,true);

		$dataProvider=new SmartDataProvider(get_class($this), array(
			'sort'=>array('defaultOrder'=>'name ASC'),
			'pagination'=>array(
				'pageSize'=>ProfileChild::getResultsPerPage(),
			),
			'criteria'=>$criteria,
		));
		$arr=$dataProvider->getData();
		foreach($arr as $account){
			$account->assignedTo=UserChild::getUserLinks($account->assignedTo);
			$account->associatedContacts=ContactChild::getContactLinks($account->associatedContacts);
		}
		$dataProvider->setData($arr);

		return $dataProvider;
	}