public function testGetSearchableAttributesAndLabels() { Yii::app()->user->userModel = User::getByUsername('super'); $searchableAttributesAndLabels = DynamicSearchUtil::getSearchableAttributesAndLabels('OpportunitiesSearchView', 'Opportunity'); $compareData = array('createdByUser' => 'Created By User', 'modifiedByUser' => 'Modified By User', 'owner' => 'Owner', 'name' => 'Name', 'probability' => 'Probability', 'account' => 'Account', 'amount' => 'Amount', 'stage' => 'Stage', 'source' => 'Source', 'ownedItemsOnly' => 'Only Items I Own', 'createdDateTime__DateTime' => 'Created Date Time', 'modifiedDateTime__DateTime' => 'Modified Date Time', 'closeDate__Date' => 'Close Date', 'account___name' => 'Account - Name'); $this->assertEquals($compareData, $searchableAttributesAndLabels); }
public function testGetSearchableAttributesAndLabels() { Yii::app()->user->userModel = User::getByUsername('super'); $searchableAttributesAndLabels = DynamicSearchUtil::getSearchableAttributesAndLabels('OpportunitiesSearchView', 'Opportunity'); $compareData = array('createdByUser' => 'Created By User', 'modifiedByUser' => 'Modified By User', 'owner' => 'Owner', 'name' => 'Name', 'probability' => 'Probability', 'account' => 'Account', 'amount' => 'Amount', 'stage' => 'Stage', 'source' => 'Source', 'ownedItemsOnly' => 'Only Items I Own', 'createdDateTime__DateTime' => 'Created Date Time', 'modifiedDateTime__DateTime' => 'Modified Date Time', 'closeDate__Date' => 'Close Date', 'account___name' => 'Account - Name'); $this->assertEquals($compareData, $searchableAttributesAndLabels); //Should sort by values $searchableAttributesAndLabels = DynamicSearchUtil::getSearchableAttributesAndLabels('ContactsSearchView', 'Contact'); $compareData = array('account' => 'Account', 'account___name' => 'Account - Name', 'anyCity' => 'Any City', 'anyCountry' => 'Any Country', 'anyEmail' => 'Any Email Address', 'anyInvalidEmail' => 'Any Invalid Email', 'anyOptOutEmail' => 'Any Opted Out Email', 'anyPostalCode' => 'Any Postal Code', 'anyState' => 'Any State', 'anyStreet' => 'Any Street', 'companyName' => 'Company Name', 'createdByUser' => 'Created By User', 'createdDateTime__DateTime' => 'Created Date Time', 'department' => 'Department', 'firstName' => 'First Name', 'googleWebTrackingId' => 'Google Web Tracking Id', 'industry' => 'Industry', 'jobTitle' => 'Job Title', 'lastName' => 'Last Name', 'latestActivity__DateTime' => 'Latest Activity Date Time', 'mobilePhone' => 'Mobile Phone', 'modifiedByUser' => 'Modified By User', 'modifiedDateTime__DateTime' => 'Modified Date Time', 'fullName' => 'Name', 'officeFax' => 'Office Fax', 'officePhone' => 'Office Phone', 'ownedItemsOnly' => 'Only Items I Own', 'owner' => 'Owner', 'title' => 'Salutation', 'source' => 'Source', 'ContactStateDropDown' => 'Status', 'website' => 'Website'); $this->assertEquals(array_values($compareData), array_values($searchableAttributesAndLabels)); }
public static function renderDynamicSearchRowContent($viewClassName, $modelClassName, $formModelClassName, $rowNumber, $attributeIndexOrDerivedType, $inputContent, $suffix = null, $renderAsAjax = false) { assert('is_string($viewClassName)'); assert('is_string($modelClassName)'); assert('is_string($formModelClassName)'); assert('is_int($rowNumber)'); assert('is_string($attributeIndexOrDerivedType) || $attributeIndexOrDerivedType == null'); assert('is_string($suffix) || $suffix == null'); assert('is_bool($renderAsAjax)'); $searchableAttributeIndicesAndDerivedTypes = DynamicSearchUtil::getSearchableAttributesAndLabels($viewClassName, $modelClassName); $ajaxOnChangeUrl = Yii::app()->createUrl("zurmo/default/dynamicSearchAttributeInput", array('viewClassName' => $viewClassName, 'modelClassName' => $modelClassName, 'formModelClassName' => $formModelClassName, 'rowNumber' => $rowNumber, 'suffix' => $suffix)); $rowView = new DynamicSearchRowView($searchableAttributeIndicesAndDerivedTypes, (int) $rowNumber, $suffix, $formModelClassName, $ajaxOnChangeUrl, $attributeIndexOrDerivedType, $inputContent); if (!$renderAsAjax) { $view = $rowView; } else { $view = new AjaxPageView($rowView); } return ZurmoHtml::tag('div', array('class' => 'dynamic-search-row'), $view->render()); }