protected function afterSave()
 {
     if ($this->isNewModel && !$this->isCompleted) {
         Yii::app()->jobQueue->add('Export', 5);
     }
     parent::afterSave();
 }
 /**
  * @return array
  */
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name', 'description', 'location', 'moduleClassName', 'startAttributeName', 'endAttributeName', 'serializedData', 'timeZone', 'color'), 'relations' => array('sharedSubscribers' => array(static::HAS_MANY, 'SavedCalendarSubscription')), 'rules' => array(array('name', 'required'), array('name', 'type', 'type' => 'string'), array('name', 'length', 'min' => 1, 'max' => 64), array('description', 'type', 'type' => 'string'), array('location', 'type', 'type' => 'string'), array('moduleClassName', 'type', 'type' => 'string'), array('moduleClassName', 'length', 'max' => 64), array('startAttributeName', 'required'), array('startAttributeName', 'type', 'type' => 'string'), array('endAttributeName', 'type', 'type' => 'string'), array('serializedData', 'type', 'type' => 'string'), array('timeZone', 'type', 'type' => 'string'), array('timeZone', 'length', 'max' => 64), array('timeZone', 'UserDefaultTimeZoneDefaultValueValidator'), array('timeZone', 'ValidateTimeZone'), array('serializedData', 'type', 'type' => 'string'), array('color', 'type', 'type' => 'string'), array('color', 'length', 'min' => 1, 'max' => 64)), 'elements' => array('moduleClassName' => 'CalendarModuleClassNameDropDown'), 'customFields' => array(), 'defaultSortAttribute' => 'name', 'noAudit' => array(), 'globalSearchAttributeNames' => array('name'));
     return $metadata;
 }
Beispiel #3
0
 protected static function translatedAttributeLabels($language)
 {
     return array_merge(parent::translatedAttributeLabels($language), array('comments' => Zurmo::t('CommentsModule', 'Comments', array(), null, $language), 'description' => Zurmo::t('ZurmoModule', 'Description', array(), null, $language), 'files' => Zurmo::t('ZurmoModule', 'Files', array(), null, $language), 'latestDateTime' => Zurmo::t('ZurmoModule', 'Latest Date Time', array(), null, $language), 'note' => Zurmo::t('NotesModule', 'Note', array(), null, $language), 'toUser' => Zurmo::t('SocialItemsModule', 'To User', array(), null, $language)));
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name'), 'relations' => array('dropDownX' => array(RedBeanModel::HAS_ONE, 'OwnedCustomField', RedBeanModel::OWNED, RedBeanModel::LINK_TYPE_SPECIFIC, 'dropDownX'), 'workflowModelTestItems' => array(RedBeanModel::HAS_MANY, 'WorkflowModelTestItem')), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32)), 'customFields' => array('dropDownX' => 'WorkflowTestDropDown'), 'elements' => array('dropDownX' => 'DropDown'));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name'), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32)));
     return $metadata;
 }
Beispiel #6
0
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('layoutId', 'layoutType', 'isDefault', 'name'), 'rules' => array(array('isDefault', 'boolean'), array('layoutId', 'required'), array('layoutId', 'type', 'type' => 'integer'), array('layoutType', 'required'), array('layoutType', 'type', 'type' => 'string'), array('layoutType', 'length', 'max' => 10), array('name', 'required'), array('name', 'type', 'type' => 'string'), array('name', 'length', 'min' => 3, 'max' => 64)), 'defaultSortAttribute' => 'name');
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('latestDateTime'), 'relations' => array('activityItems' => array(static::MANY_MANY, 'Item')), 'rules' => array(array('latestDateTime', 'required'), array('latestDateTime', 'readOnly'), array('latestDateTime', 'type', 'type' => 'datetime')), 'elements' => array('activityItems' => 'ActivityItem', 'latestDateTime' => 'DateTime'), 'activityItemsModelClassNames' => array('Account', 'Contact', 'Opportunity'));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name', 'phone'), 'relations' => array('hasMany2' => array(static::HAS_MANY, 'ReportModelTestItem', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOne'), 'hasMany3' => array(static::MANY_MANY, 'ReportModelTestItem3')), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32), array('phone', 'type', 'type' => 'string'), array('phone', 'length', 'min' => 1, 'max' => 14)));
     return $metadata;
 }
Beispiel #9
0
 protected static function translatedAttributeLabels($language)
 {
     return array_merge(parent::translatedAttributeLabels($language), array('account' => Zurmo::t('EmailMessagesModule', 'Email Account', array(), null, $language), 'content' => Zurmo::t('EmailMessagesModule', 'Content', array(), null, $language), 'error' => Zurmo::t('Core', 'Error', array(), null, $language), 'folder' => Zurmo::t('ZurmoModule', 'Folder', array(), null, $language), 'files' => Zurmo::t('ZurmoModule', 'Files', array(), null, $language), 'recipients' => Zurmo::t('EmailMessagesModule', 'Recipients', array(), null, $language), 'sender' => Zurmo::t('EmailMessagesModule', 'Sender', array(), null, $language), 'sendAttempts' => Zurmo::t('EmailMessagesModule', 'Send Attempts', array(), null, $language), 'sentDateTime' => Zurmo::t('EmailMessagesModule', 'Sent Date Time', array(), null, $language), 'subject' => Zurmo::t('EmailMessagesModule', 'Subject', array(), null, $language), 'type' => Zurmo::t('Core', 'Type', array(), null, $language)));
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name'), 'relations' => array('workflowModelTestItem9' => array(static::HAS_MANY_BELONGS_TO, 'WorkflowModelTestItem9'), 'workflowModelTestItem9s' => array(static::HAS_MANY, 'WorkflowModelTestItem9'), 'dropDown' => array(static::HAS_ONE, 'OwnedCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'dropDown'), 'hasMany' => array(static::HAS_MANY, 'WorkflowModelTestItem', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasMany'), 'manyMany' => array(static::MANY_MANY, 'WorkflowModelTestItem', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'manyMany'), 'hasOne' => array(static::HAS_ONE, 'WorkflowModelTestItem', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOne'), 'hasOne2' => array(static::HAS_ONE, 'WorkflowModelTestItem5', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOne2'), 'hasOne3' => array(static::HAS_ONE, 'WorkflowModelTestItem', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOne3'), 'hasOne4' => array(static::HAS_ONE, 'WorkflowModelTestItem8', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOne4')), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32)), 'customFields' => array('dropDown' => 'WorkflowTestDropDown'), 'elements' => array('dropDown' => 'DropDown'));
     return $metadata;
 }
Beispiel #11
0
 /**
  * Sets the scenario for currencyvalue elements to positiveValue for the validation of the price
  * using the rule in CurrencyValue
  * @return bool
  */
 protected function beforeValidate()
 {
     $this->sellPrice->setScenario('positiveValue');
     return parent::beforeValidate();
 }
Beispiel #12
0
 protected static function translatedAttributeLabels($language)
 {
     return array_merge(parent::translatedAttributeLabels($language), array('name' => Zurmo::t('ZurmoModule', 'Name', null, null, $language), 'status' => Zurmo::t('CampaignsModule', 'Status', null, null, $language), 'sendOnDateTime' => Zurmo::t('CampaignsModule', 'Send On', null, null, $language), 'supportsRichText' => Zurmo::t('CampaignsModule', 'Supports HTML', null, null, $language), 'fromName' => Zurmo::t('CampaignsModule', 'From Name', null, null, $language), 'fromAddress' => Zurmo::t('CampaignsModule', 'From Address', null, null, $language), 'subject' => Zurmo::t('EmailMessagesModule', 'Subject', null, null, $language), 'htmlContent' => Zurmo::t('EmailMessagesModule', 'Html Content', null, null, $language), 'textContent' => Zurmo::t('EmailMessagesModule', 'Text Content', null, null, $language)));
 }
Beispiel #13
0
 protected function afterDelete()
 {
     foreach ($this->campaignItems as $item) {
         $item->delete();
     }
     return parent::afterDelete();
 }
 /**
  * @return array
  */
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name', 'redirectUrl', 'submitButtonLabel', 'serializedData', 'excludeStyles', 'enableCaptcha', 'language', 'defaultPermissionSetting', 'defaultPermissionGroupSetting'), 'relations' => array('defaultState' => array(static::HAS_ONE, 'ContactState', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'defaultState'), 'entries' => array(static::HAS_MANY, 'ContactWebFormEntry', static::OWNED, static::LINK_TYPE_SPECIFIC, 'entries'), 'defaultOwner' => array(static::HAS_ONE, 'User', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'defaultOwner')), 'rules' => array(array('name', 'required'), array('name', 'type', 'type' => 'string'), array('redirectUrl', 'required'), array('redirectUrl', 'url', 'defaultScheme' => 'http'), array('submitButtonLabel', 'required'), array('submitButtonLabel', 'type', 'type' => 'string'), array('submitButtonLabel', 'default', 'value' => 'Submit'), array('defaultState', 'required'), array('serializedData', 'required'), array('serializedData', 'type', 'type' => 'string'), array('defaultOwner', 'required'), array('excludeStyles', 'type', 'type' => 'boolean'), array('excludeStyles', 'default', 'value' => 0), array('enableCaptcha', 'type', 'type' => 'boolean'), array('enableCaptcha', 'default', 'value' => 0), array('language', 'type', 'type' => 'string'), array('language', 'length', 'max' => 10), array('defaultPermissionSetting', 'numerical', 'min' => UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER, 'max' => UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE), array('defaultPermissionGroupSetting', 'numerical', 'min' => 1)), 'elements' => array('name' => 'Text', 'redirectUrl' => 'Text', 'submitButtonLabel' => 'Text', 'defaultState' => 'ContactState', 'defaultOwner' => 'User'), 'defaultSortAttribute' => 'name', 'noAudit' => array('serializedData', 'entries'));
     return $metadata;
 }
 protected static function translatedAttributeLabels($language)
 {
     return array_merge(parent::translatedAttributeLabels($language), array('description' => Zurmo::t('ZurmoModule', 'Description', array(), null, $language), 'name' => Zurmo::t('Core', 'Name', array(), null, $language), 'type' => Zurmo::t('Core', 'Type', array(), null, $language)));
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name'), 'relations' => array('primaryEmail' => array(static::HAS_ONE, 'Email', static::OWNED, static::LINK_TYPE_SPECIFIC, 'primaryEmail'), 'secondaryEmail' => array(static::HAS_ONE, 'Email', static::OWNED, static::LINK_TYPE_SPECIFIC, 'secondaryEmail')), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32)), 'elements' => array('primaryEmail' => 'EmailAddressInformation', 'secondaryEmail' => 'EmailAddressInformation'));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('closeDate', 'description', 'name', 'probability'), 'relations' => array('account' => array(static::HAS_ONE, 'Account'), 'amount' => array(static::HAS_ONE, 'CurrencyValue', static::OWNED, static::LINK_TYPE_SPECIFIC, 'amount'), 'products' => array(static::HAS_MANY, 'Product'), 'contacts' => array(static::MANY_MANY, 'Contact'), 'stage' => array(static::HAS_ONE, 'OwnedCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'stage'), 'source' => array(static::HAS_ONE, 'OwnedCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'source'), 'projects' => array(static::MANY_MANY, 'Project')), 'derivedRelationsViaCastedUpModel' => array('meetings' => array(static::MANY_MANY, 'Meeting', 'activityItems'), 'notes' => array(static::MANY_MANY, 'Note', 'activityItems'), 'tasks' => array(static::MANY_MANY, 'Task', 'activityItems')), 'rules' => array(array('amount', 'required'), array('closeDate', 'required'), array('closeDate', 'type', 'type' => 'date'), array('description', 'type', 'type' => 'string'), array('name', 'required'), array('name', 'type', 'type' => 'string'), array('name', 'length', 'min' => 1, 'max' => 64), array('probability', 'type', 'type' => 'integer'), array('probability', 'numerical', 'min' => 0, 'max' => 100), array('probability', 'required'), array('probability', 'default', 'value' => 0), array('probability', 'probability'), array('stage', 'required')), 'elements' => array('amount' => 'CurrencyValue', 'account' => 'Account', 'closeDate' => 'Date', 'description' => 'TextArea'), 'customFields' => array('stage' => 'SalesStages', 'source' => 'LeadSources'), 'defaultSortAttribute' => 'name', 'rollupRelations' => array('contacts'), 'noAudit' => array('description'));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('emailAddress'), 'rules' => array(array('emailAddress', 'type', 'type' => 'string'), array('emailAddress', 'length', 'min' => 6, 'max' => 64), array('emailAddress', 'email')));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name', 'somethingOn3'), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32), array('somethingOn3', 'type', 'type' => 'string'), array('somethingOn3', 'length', 'max' => 32)), 'relations' => array('hasMany1' => array(RedBeanModel::MANY_MANY, 'WorkflowModelTestItem')));
     return $metadata;
 }
Beispiel #20
0
 /**
  * After a mission is saved, if it is new, then a notification should go out to all users alerting them
  * of a new mission.  Depending on the status change of the mission, a notification can go out as well to
  * the owner or user who has taken the mission.
  */
 protected function afterSave()
 {
     if ($this->isNewModel && $this->getScenario() != 'importModel') {
         MissionsUtil::makeAndSubmitNewMissionNotificationMessage($this);
     }
     if (isset($this->originalAttributeValues['status']) && !$this->isNewModel && $this->originalAttributeValues['status'] != $this->status) {
         if ($this->status == self::STATUS_TAKEN) {
             $messageContent = Zurmo::t('MissionsModule', 'A mission you created has been taken on by {takenByUserName}', array('{takenByUserName}' => strval($this->takenByUser)));
             MissionsUtil::makeAndSubmitStatusChangeNotificationMessage($this->owner, $this->id, $messageContent);
         } elseif ($this->status == self::STATUS_COMPLETED) {
             $messageContent = Zurmo::t('MissionsModule', 'A mission you created has been completed');
             MissionsUtil::makeAndSubmitStatusChangeNotificationMessage($this->owner, $this->id, $messageContent);
         } elseif ($this->status == self::STATUS_REJECTED && $this->takenByUser->id > 0) {
             $messageContent = Zurmo::t('MissionsModule', 'A mission you completed has been rejected');
             MissionsUtil::makeAndSubmitStatusChangeNotificationMessage($this->takenByUser, $this->id, $messageContent);
         } elseif ($this->status == self::STATUS_ACCEPTED && $this->takenByUser->id > 0) {
             $messageContent = Zurmo::t('MissionsModule', 'A mission you completed has been accepted');
             MissionsUtil::makeAndSubmitStatusChangeNotificationMessage($this->takenByUser, $this->id, $messageContent);
         }
     }
     parent::afterSave();
 }
 public function onBeforeOwnerChange(CEvent $event)
 {
     parent::__set('member2', 'onBeforeOwnerChange');
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name'), 'relations' => array('modelItem' => array(static::HAS_ONE, 'ApiTestModelItem', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'modelItem')), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32)), 'elements' => array('modelItem' => 'ApiModelTestItem'));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('firstName', 'lastName', 'boolean', 'date', 'dateTime', 'decimal', 'float', 'integer', 'numerical', 'phone', 'string', 'textArea', 'url'), 'relations' => array('currencyValue' => array(static::HAS_ONE, 'CurrencyValue', static::OWNED), 'dropDown' => array(static::HAS_ONE, 'OwnedCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'dropDown'), 'radioDropDown' => array(static::HAS_ONE, 'OwnedCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'radioDropDown'), 'multiDropDown' => array(static::HAS_ONE, 'OwnedMultipleValuesCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'multiDropDown'), 'tagCloud' => array(static::HAS_ONE, 'OwnedMultipleValuesCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'tagCloud'), 'hasOne' => array(static::HAS_ONE, 'ImportModelTestItem2', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOne'), 'hasMany' => array(static::MANY_MANY, 'ImportModelTestItem3'), 'hasOneAlso' => array(static::HAS_ONE, 'ImportModelTestItem4', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOneAlso'), 'primaryEmail' => array(static::HAS_ONE, 'Email', static::OWNED, static::LINK_TYPE_SPECIFIC, 'primaryEmail'), 'primaryAddress' => array(static::HAS_ONE, 'Address', static::OWNED, static::LINK_TYPE_SPECIFIC, 'primaryAddress'), 'secondaryEmail' => array(static::HAS_ONE, 'Email', static::OWNED, static::LINK_TYPE_SPECIFIC, 'secondaryEmail')), 'rules' => array(array('firstName', 'type', 'type' => 'string'), array('firstName', 'length', 'min' => 1, 'max' => 32), array('lastName', 'required'), array('lastName', 'type', 'type' => 'string'), array('lastName', 'length', 'min' => 2, 'max' => 32), array('boolean', 'boolean'), array('date', 'type', 'type' => 'date'), array('dateTime', 'type', 'type' => 'datetime'), array('decimal', 'type', 'type' => 'float'), array('decimal', 'numerical', 'precision' => 2), array('float', 'type', 'type' => 'float'), array('integer', 'type', 'type' => 'integer'), array('numerical', 'type', 'type' => 'integer'), array('numerical', 'numerical', 'min' => 0, 'max' => 100), array('phone', 'type', 'type' => 'string'), array('phone', 'length', 'min' => 1, 'max' => 14), array('string', 'required'), array('string', 'type', 'type' => 'string'), array('string', 'length', 'min' => 3, 'max' => 64), array('textArea', 'type', 'type' => 'string'), array('url', 'url')), 'elements' => array('currencyValue' => 'CurrencyValue', 'date' => 'Date', 'dateTime' => 'DateTime', 'hasOne' => 'ImportModelTestItem2', 'hasOneAlso' => 'ImportModelTestItem4', 'phone' => 'Phone', 'primaryEmail' => 'EmailAddressInformation', 'secondaryEmail' => 'EmailAddressInformation', 'primaryAddress' => 'Address', 'textArea' => 'TextArea', 'radioDropDown' => 'RadioDropDown', 'multiDropDown' => 'MultiSelectDropDown', 'tagCloud' => 'TagCloud'), 'customFields' => array('dropDown' => 'ImportTestDropDown', 'radioDropDown' => 'ImportTestRadioDropDown', 'multiDropDown' => 'ImportTestMultiDropDown', 'tagCloud' => 'ImportTestTagCloud'));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name', 'integer'), 'relations' => array('workflowItems' => array(static::MANY_MANY, 'Item'), 'hasOne' => array(static::HAS_ONE, 'WorkflowModelTestItem9', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOne')), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32), array('integer', 'type', 'type' => 'integer')), 'workflowItemsModelClassNames' => array('WorkflowModelTestItem', 'WorkflowModelTestItem2'));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name', 'integer'), 'relations' => array('reportItems' => array(RedBeanModel::MANY_MANY, 'Item')), 'rules' => array(array('name', 'type', 'type' => 'string'), array('name', 'length', 'max' => 32), array('integer', 'type', 'type' => 'integer')), 'reportItemsModelClassNames' => array('ReportModelTestItem', 'ReportModelTestItem2'));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('member'), 'rules' => array(array('member', 'required'), array('member', 'type', 'type' => 'string'), array('member', 'length', 'max' => 255)), 'relations' => array('currencyValue' => array(static::HAS_ONE, 'CurrencyValue', static::OWNED)));
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('name', 'description', 'fromName', 'fromAddress', 'anyoneCanSubscribe'), 'relations' => array('marketingListMembers' => array(static::HAS_MANY, 'MarketingListMember', static::OWNED), 'autoresponders' => array(static::HAS_MANY, 'Autoresponder', static::OWNED), 'campaigns' => array(static::HAS_MANY, 'Campaign', static::OWNED)), 'rules' => array(array('name', 'required'), array('name', 'type', 'type' => 'string'), array('name', 'length', 'min' => 1, 'max' => 64), array('description', 'type', 'type' => 'string'), array('fromName', 'type', 'type' => 'string'), array('fromName', 'length', 'min' => 1, 'max' => 64), array('fromAddress', 'type', 'type' => 'string'), array('fromAddress', 'length', 'min' => 6, 'max' => 64), array('fromAddress', 'email'), array('anyoneCanSubscribe', 'boolean'), array('anyoneCanSubscribe', 'default', 'value' => false)), 'elements' => array('anyoneCanSubscribe' => 'CheckBox', 'description' => 'TextArea'), 'defaultSortAttribute' => 'name');
     return $metadata;
 }
 public static function getDefaultMetadata()
 {
     $metadata = parent::getDefaultMetadata();
     $metadata[__CLASS__] = array('members' => array('firstName', 'lastName', 'boolean', 'boolean2', 'date', 'date2', 'date3', 'date4', 'dateTime', 'dateTime2', 'dateTime3', 'dateTime4', 'float', 'integer', 'cannotTrigger', 'phone', 'string', 'textArea', 'url', 'status'), 'relations' => array('currencyValue' => array(static::HAS_ONE, 'CurrencyValue', static::OWNED), 'dropDown' => array(static::HAS_ONE, 'OwnedCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'dropDown'), 'dropDown2' => array(static::HAS_ONE, 'OwnedCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'dropDown2'), 'radioDropDown' => array(static::HAS_ONE, 'OwnedCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'radioDropDown'), 'multiDropDown' => array(static::HAS_ONE, 'OwnedMultipleValuesCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'multiDropDown'), 'tagCloud' => array(static::HAS_ONE, 'OwnedMultipleValuesCustomField', static::OWNED, static::LINK_TYPE_SPECIFIC, 'tagCloud'), 'hasOne' => array(static::HAS_ONE, 'WorkflowModelTestItem2', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOne'), 'hasOneAgain' => array(static::HAS_ONE, 'WorkflowModelTestItem2', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOneAgain'), 'hasMany' => array(static::HAS_MANY, 'WorkflowModelTestItem3', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasMany'), 'hasOneAlso' => array(static::HAS_ONE, 'WorkflowModelTestItem4', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'hasOneAlso'), 'primaryEmail' => array(static::HAS_ONE, 'Email', static::OWNED, static::LINK_TYPE_SPECIFIC, 'primaryEmail'), 'primaryAddress' => array(static::HAS_ONE, 'Address', static::OWNED, static::LINK_TYPE_SPECIFIC, 'primaryAddress'), 'secondaryEmail' => array(static::HAS_ONE, 'Email', static::OWNED, static::LINK_TYPE_SPECIFIC, 'secondaryEmail'), 'cannotTrigger2' => array(static::MANY_MANY, 'WorkflowModelTestItem5'), 'usedAsAttribute' => array(static::HAS_ONE, 'WorkflowModelTestItem6', static::NOT_OWNED), 'likeContactState' => array(static::HAS_ONE, 'ContactState', static::NOT_OWNED, static::LINK_TYPE_SPECIFIC, 'likeContactState'), 'user' => array(static::HAS_ONE, 'User', static::NOT_OWNED), 'user2' => array(static::HAS_ONE, 'User', static::NOT_OWNED)), 'derivedRelationsViaCastedUpModel' => array('model5ViaItem' => array(static::MANY_MANY, 'WorkflowModelTestItem5', 'workflowItems')), 'rules' => array(array('firstName', 'type', 'type' => 'string'), array('firstName', 'length', 'min' => 1, 'max' => 32), array('lastName', 'required'), array('lastName', 'type', 'type' => 'string'), array('lastName', 'length', 'min' => 2, 'max' => 32), array('boolean', 'boolean'), array('boolean2', 'boolean'), array('date', 'type', 'type' => 'date'), array('date2', 'type', 'type' => 'date'), array('date3', 'type', 'type' => 'date'), array('date4', 'type', 'type' => 'date'), array('dateTime', 'type', 'type' => 'datetime'), array('dateTime2', 'type', 'type' => 'datetime'), array('dateTime3', 'type', 'type' => 'datetime'), array('dateTime4', 'type', 'type' => 'datetime'), array('float', 'type', 'type' => 'float'), array('float', 'length', 'min' => 2, 'max' => 64), array('integer', 'type', 'type' => 'integer'), array('integer', 'length', 'min' => 2, 'max' => 64), array('cannotTrigger', 'type', 'type' => 'string'), array('cannotTrigger', 'length', 'min' => 1, 'max' => 64), array('phone', 'type', 'type' => 'string'), array('phone', 'length', 'min' => 1, 'max' => 14), array('string', 'required'), array('string', 'type', 'type' => 'string'), array('string', 'length', 'min' => 1, 'max' => 64), array('textArea', 'type', 'type' => 'string'), array('url', 'url'), array('status', 'type', 'type' => 'integer')), 'elements' => array('currencyValue' => 'CurrencyValue', 'date' => 'Date', 'date2' => 'Date', 'date3' => 'Date', 'date4' => 'Date', 'dateTime' => 'DateTime', 'dateTime2' => 'DateTime', 'dateTime3' => 'DateTime', 'dateTime4' => 'DateTime', 'dropDown' => 'DropDown', 'dropDown2' => 'DropDown', 'hasOne' => 'ImportModelTestItem2', 'hasOneAlso' => 'ImportModelTestItem4', 'likeContactState' => 'ContactState', 'phone' => 'Phone', 'primaryEmail' => 'EmailAddressInformation', 'secondaryEmail' => 'EmailAddressInformation', 'primaryAddress' => 'Address', 'textArea' => 'TextArea', 'radioDropDown' => 'RadioDropDown', 'multiDropDown' => 'MultiSelectDropDown', 'tagCloud' => 'TagCloud', 'user' => 'User', 'user2' => 'User', 'status' => 'StatusDropDown'), 'customFields' => array('dropDown' => 'WorkflowTestDropDown', 'radioDropDown' => 'WorkflowTestRadioDropDown', 'multiDropDown' => 'WorkflowTestMultiDropDown', 'tagCloud' => 'WorkflowTestTagCloud'));
     return $metadata;
 }
 /**
  * Alter hasReadLatest and/or ownerHasReadLatest based on comments being added.
  * (non-PHPdoc)
  * @see Item::beforeSave()
  */
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->comments->isModified() || $this->getIsNewModel()) {
             $this->unrestrictedSet('latestDateTime', DateTimeUtil::convertTimestampToDbFormatDateTime(time()));
             if ($this->getIsNewModel()) {
                 $this->ownerHasReadLatest = true;
             }
         }
         if ($this->comments->isModified()) {
             foreach ($this->comments as $comment) {
                 if ($comment->id < 0) {
                     if (Yii::app()->user->userModel != $this->owner) {
                         $this->ownerHasReadLatest = false;
                     }
                     foreach ($this->conversationParticipants as $position => $participant) {
                         //At this point the createdByUser is not populated yet in the comment, so we can
                         //use the current user.
                         if ($participant->person->getClassId('Item') != Yii::app()->user->userModel->getClassId('Item')) {
                             $this->conversationParticipants[$position]->hasReadLatest = false;
                         }
                     }
                 }
             }
         }
         return true;
     } else {
         return false;
     }
 }
Beispiel #30
0
 protected static function translatedAttributeLabels($language)
 {
     return array_merge(parent::translatedAttributeLabels($language), array('name' => Zurmo::t('Core', 'Name', array(), null, $language)));
 }