当前位置: 首页>>代码示例>>PHP>>正文


PHP X2Model::getModelName方法代码示例

本文整理汇总了PHP中X2Model::getModelName方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Model::getModelName方法的具体用法?PHP X2Model::getModelName怎么用?PHP X2Model::getModelName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在X2Model的用法示例。


在下文中一共展示了X2Model::getModelName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateModelName

 public function validateModelName($attr)
 {
     $value = $this->{$attr};
     $modules = MobileModule::supportedModules(new CDbCriteria(array('condition' => 'editable')));
     $validNames = array_map(function ($module) {
         return X2Model::getModelName($module->name);
     }, $modules);
     if (!in_array($value, $validNames)) {
         $this->addError($attr, Yii::t('app', 'Invalid model name'));
     }
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:11,代码来源:EditMobileFormsFormModel.php

示例2: getStageMemberDataProvider

 /**
  * Get a data provider for members of a given type in a given stage
  * @param string $type {'contacts', 'opportunities', 'accounts'}
  */
 public function getStageMemberDataProvider($type, $workflowId, $dateRange, $expectedCloseDateDateRange, $stage, $user, $perStageWorkflowView = true)
 {
     $modelName = X2Model::getModelName($type);
     $model = X2Model::model($modelName);
     $tableName = $model->tableName();
     $params = array(':workflowId' => $workflowId, ':stage' => $stage, ':start' => $dateRange['start'], ':end' => $dateRange['end'], ':type' => $type);
     if ($expectedCloseDateDateRange['range'] !== 'all') {
         $params = array_merge($params, array(':expectedCloseDateStart' => $expectedCloseDateDateRange['end'], ':expectedCloseDateEnd' => $expectedCloseDateDateRange['end']));
     }
     if (!empty($user)) {
         $userString = " AND x2_actions.assignedTo=:user ";
         $params[':user'] = $user;
     } else {
         $userString = "";
     }
     list($accessCondition, $accessConditionParams) = $modelName::model()->getAccessSQLCondition($tableName);
     $params = array_merge($params, $accessConditionParams);
     $stageMemberSql = Yii::app()->db->createCommand()->select("{$tableName}.*, x2_actions.lastUpdated as actionLastUpdated")->from($tableName)->join('x2_actions', "{$tableName}.id = x2_actions.associationId")->where(($expectedCloseDateDateRange['range'] !== 'all' ? $tableName . '.expectedCloseDate 
                 BETWEEN :expectedCloseDateStart AND :expectedCloseDateEnd AND ' : '') . "x2_actions.workflowId=:workflowId AND x2_actions.stageNumber=:stage AND\n                x2_actions.associationType=:type AND complete!='Yes' AND \n                (completeDate IS NULL OR completeDate=0) AND \n                x2_actions.createDate BETWEEN :start AND :end " . $userString . " AND " . $accessCondition)->getText();
     $memberCount = Yii::app()->db->createCommand()->select("COUNT(*)")->from($tableName)->join('x2_actions', "{$tableName}.id = x2_actions.associationId")->where(($expectedCloseDateDateRange['range'] !== 'all' ? $tableName . '.expectedCloseDate 
                 BETWEEN :expectedCloseDateStart AND :expectedCloseDateEnd AND ' : '') . "x2_actions.workflowId=:workflowId AND x2_actions.stageNumber=:stage AND\n                x2_actions.associationType=:type AND complete!='Yes' AND \n                (completeDate IS NULL OR completeDate=0) AND \n                x2_actions.createDate BETWEEN :start AND :end " . $userString . ' AND ' . $accessCondition, $params)->queryScalar();
     $membersDataProvider = new CSqlDataProvider($stageMemberSql, array('totalItemCount' => $memberCount, 'sort' => array('defaultOrder' => 'lastUpdated DESC'), 'pagination' => !$perStageWorkflowView ? false : array('pageSize' => 20), 'params' => $params));
     return $membersDataProvider;
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:28,代码来源:WorkflowController.php

示例3: array

                        </td>
                    </tr>

                    <tr class="formSectionRow">
                        <td style="width: 300px">
                            <div class="formItem leftLabel">
                                <label><?php 
echo Yii::t('media', 'Association Name');
?>
</label>
                                <div class="formInputBox" style="width: 200px; height: auto;">
                                    <?php 
if ($model->associationType && $model->associationType != 'bg') {
    ?>
                                        <?php 
    if (!empty($model->associationId) && is_numeric($model->associationId) && ($modelName = X2Model::getModelName($model->associationType))) {
        $linkModel = X2Model::model($modelName)->findByPk($model->associationId);
        if (isset($linkModel)) {
            echo CHtml::link(CHtml::encode($linkModel->name), array('/' . $model->associationType . '/' . $model->associationId));
        } else {
            echo '';
        }
    } else {
        echo '';
    }
    ?>
                                    <?php 
}
?>
                                </div>
                            </div>
开发者ID:keyeMyria,项目名称:CRM,代码行数:31,代码来源:view.php

示例4: getModelOfTypeWithName

 public static function getModelOfTypeWithName($type, $name)
 {
     $modelName = X2Model::getModelName($type);
     // both ID and type must be set
     if (!(empty($type) || empty($name)) && $modelName) {
         // both ID and type must be set
         $model = X2Model::model($modelName);
         if ($model->hasAttribute('name')) {
             return $model->findByAttributes(array('name' => $name));
         }
     }
     return null;
     // invalid type or invalid name
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:14,代码来源:X2Model.php

示例5: echo

        echo ($legacy ? '<br />' : '') . CHtml::link(Yii::t('app', '[View email]'), '#', array('onclick' => 'return false;', 'id' => $data->id, 'class' => 'email-frame'));
    } elseif ($data->type == 'quotesDeleted') {
        echo $data->actionDescription;
    } elseif ($data->type == 'quotes') {
        $data->renderInlineViewLink();
    } else {
        echo Yii::app()->controller->convertUrls(CHtml::encode($data->actionDescription));
    }
}
// convert LF and CRLF to <br />
?>
    </div>
    <div class="footer">
        <?php 
if (isset($relationshipFlag) && $relationshipFlag && $data->associationId !== 0 && X2Model::getModelName($data->associationType) !== false) {
    $relString = " | " . X2Model::getModelLink($data->associationId, X2Model::getModelName($data->associationType));
} else {
    $relString = "";
}
if (empty($data->type) || $data->type == 'weblead' || $data->type == 'workflow') {
    if ($data->complete == 'Yes') {
        echo Yii::t('actions', 'Completed by {name}', array('{name}' => User::getUserLinks($data->completedBy))) . $relString;
    } else {
        $userLink = User::getUserLinks($data->assignedTo);
        $userLink = empty($userLink) ? Yii::t('actions', 'Anyone') : $userLink;
        echo Yii::t('actions', 'Assigned to {name}', array('{name}' => $userLink)) . $relString;
    }
} else {
    if (in_array($data->type, array('note', 'call', 'emailOpened', 'time'))) {
        echo $data->completedBy == 'Guest' ? "Guest" : User::getUserLinks($data->completedBy) . $relString;
        // echo ' '.Formatter::formatDate($data->completeDate);
开发者ID:dsyman2,项目名称:X2CRM,代码行数:31,代码来源:_view.php

示例6: getDisplayedModelNamesList

 /**
  * Legacy function kept for backwards compatibility.
  *
  * Moved from {@link Admin} and renamed from getModelList because it doesn't
  * make sense to put it there; it doesn't fit in a model intended for
  * managing system settings, but it does in this model, which is intended
  * for managing data models themselves.
  *
  * @return array
  */
 public static function getDisplayedModelNamesList()
 {
     $modelList = array();
     foreach (X2Model::model('Modules')->findAllByAttributes(array('editable' => true, 'visible' => 1)) as $module) {
         if ($modelName = X2Model::getModelName($module->name)) {
             $modelName = $module->name;
         } else {
             $modelName = ucfirst($module->name);
         }
         if (Yii::app()->user->checkAccess(ucfirst($module->name) . 'Index', array())) {
             $modelList[$modelName] = $module->title;
         }
     }
     return array_map(function ($term) {
         return Yii::t('app', $term);
     }, $modelList);
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:27,代码来源:Fields.php

示例7: actionParseType

 public function actionParseType()
 {
     if (isset($_POST['Actions']['associationType'])) {
         $type = $_POST['Actions']['associationType'];
         if ($modelName = X2Model::getModelName($type)) {
             $linkModel = $modelName;
             if (class_exists($linkModel)) {
                 if ($linkModel == "X2Calendar") {
                     $linkSource = '';
                 } else {
                     $linkSource = $this->createUrl(X2Model::model($linkModel)->autoCompleteSource);
                 }
             } else {
                 $linkSource = "";
             }
             echo $linkSource;
         } else {
             echo '';
         }
     } else {
         echo '';
     }
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:23,代码来源:ActionsController.php

示例8: getStageCounts

 /**
  * Get number of records at each stage
  * @param array $workflowStatus
  * @param array $dateRange return value of WorkflowController::getDateRange ()
  * @param string $users users filter
  * @param string $modelType model type filter
  * @return array number of records at each stage subject to specified filters
  */
 public static function getStageCounts(&$workflowStatus, $dateRange, $expectedCloseDateDateRange, $users = '', $modelType = '')
 {
     $stageCount = count($workflowStatus['stages']);
     if ($users !== '') {
         $userString = " AND x2_actions.assignedTo='{$users}' ";
     } else {
         $userString = "";
     }
     $params = array(':start' => $dateRange['start'], ':end' => $dateRange['end'], ':workflowId' => $workflowStatus['id']);
     if ($expectedCloseDateDateRange['range'] !== 'all') {
         $params = array_merge($params, array(':expectedCloseDateStart' => $expectedCloseDateDateRange['end'], ':expectedCloseDateEnd' => $expectedCloseDateDateRange['end']));
     }
     $stageCounts = array();
     $models = self::getModelsFromTypesArr($modelType);
     for ($i = 1; $i <= $stageCount; $i++) {
         $recordsAtStage = 0;
         foreach ($models as $type => $model) {
             $tableName = $model->tableName();
             $modelName = X2Model::getModelName($type);
             list($accessCondition, $accessConditionParams) = $modelName::model()->getAccessSQLCondition($tableName);
             $countParams = array_merge($params, $accessConditionParams);
             $recordsAtStage += Yii::app()->db->createCommand()->select("COUNT(*)")->from($tableName)->join('x2_actions', 'x2_actions.associationId=' . $tableName . '.id')->where("x2_actions.complete != 'Yes' {$userString} AND \n                        (x2_actions.completeDate IS NULL OR x2_actions.completeDate = 0) AND \n                        x2_actions.createDate BETWEEN :start AND :end AND\n                        x2_actions.type='workflow' AND workflowId=:workflowId AND \n                        stageNumber=" . $i . " AND associationType='" . $type . "'" . ' AND ' . $accessCondition . ($expectedCloseDateDateRange['range'] !== 'all' ? ' AND ' . $tableName . '.expectedCloseDate 
                         BETWEEN :expectedCloseDateStart AND :expectedCloseDateEnd' : ''), $countParams)->queryScalar();
         }
         $stageCounts[] = $recordsAtStage;
     }
     return $stageCounts;
 }
开发者ID:keyeMyria,项目名称:CRM,代码行数:36,代码来源:Workflow.php

示例9: getStageCounts

 /**
  * Get number of records at each stage
  * @param array $workflowStatus
  * @param array $dateRange return value of WorkflowController::getDateRange ()
  * @param string $users users filter
  * @param string $modelType model type filter
  * @return array number of records at each stage subject to specified filters
  */
 public static function getStageCounts(&$workflowStatus, $dateRange, $expectedCloseDateDateRange, $users = '', $modelType = 'contacts')
 {
     $stageCount = count($workflowStatus['stages']);
     if ($users !== '') {
         $userString = " AND x2_actions.assignedTo='{$users}' ";
     } else {
         $userString = "";
     }
     $params = array(':start' => $dateRange['start'], ':end' => $dateRange['end'], ':workflowId' => $workflowStatus['id']);
     if ($expectedCloseDateDateRange['range'] !== 'all') {
         $params = array_merge($params, array(':expectedCloseDateStart' => $expectedCloseDateDateRange['end'], ':expectedCloseDateEnd' => $expectedCloseDateDateRange['end']));
     }
     $stageCounts = array();
     $modelName = X2Model::getModelName($modelType);
     $model = X2Model::model($modelName);
     $tableName = $model->tableName();
     list($accessCondition, $accessConditionParams) = $modelName::model()->getAccessSQLCondition($tableName);
     $allParams = array_merge($params, $accessConditionParams);
     $recordsAtStages = Yii::app()->db->createCommand()->select("stageNumber, COUNT(*)")->from($tableName)->join('x2_actions', 'x2_actions.associationId=' . $tableName . '.id')->where("x2_actions.complete != 'Yes' {$userString} AND \n                (x2_actions.completeDate IS NULL OR x2_actions.completeDate = 0) AND \n                x2_actions.createDate BETWEEN :start AND :end AND\n                x2_actions.type='workflow' AND workflowId=:workflowId AND \n                 associationType='" . $modelType . "' AND " . $accessCondition . ($expectedCloseDateDateRange['range'] !== 'all' ? ' AND ' . $tableName . '.expectedCloseDate 
                 BETWEEN :expectedCloseDateStart AND :expectedCloseDateEnd' : ''), $allParams)->group('stageNumber')->queryAll();
     foreach ($recordsAtStages as $row) {
         $stage = WorkflowStage::model()->findByPK($row['stageNumber']);
         if ($stage) {
             $stageCounts[$stage->stageNumber - 1] = $row['COUNT(*)'];
         }
     }
     for ($i = 0; $i < $stageCount; $i++) {
         if (!isset($stageCounts[$i])) {
             $stageCounts[$i] = 0;
         }
     }
     ksort($stageCounts);
     return $stageCounts;
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:42,代码来源:Workflow.php

示例10: getDialogTooltipsForModels

 /**
  * Returns array of tooltips to be applied to quick create buttons for each model 
  * @param array $models
  * @param string $modelName
  * @return array
  */
 public static function getDialogTooltipsForModels($models, $modelName)
 {
     $tooltips = array_flip($models);
     array_walk($tooltips, function (&$val, $key) use($modelName) {
         $val = Yii::t('app', 'Create a new {relatedModelClass} associated with this {modelClass}', array('{relatedModelClass}' => X2Model::getRecordName($key), '{modelClass}' => X2Model::getRecordName(X2Model::getModelName($modelName))));
     });
     return $tooltips;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:14,代码来源:QuickCreateRelationshipBehavior.php

示例11: foreach

     }
 }
 // At this stage, all nameId fields have been created and populated.
 //
 // Now it's time to update the referencing columns:
 $linkFields = Yii::app()->db->createCommand()->select('modelName,fieldName,linkType')->from('x2_fields')->where('type="link" AND linkType IS NOT NULL AND linkType != ""')->queryAll(true);
 foreach ($linkFields as $field) {
     if ($debug) {
         echo "updating refs for field {$field['modelName']}.{$field['fieldName']}\n";
     }
     $class = X2Model::getModelName($field['modelName']);
     if (empty($class) || !class_exists($class)) {
         continue;
     }
     $model = X2Model::model($class);
     $referencedClass = X2Model::getModelName($field['linkType']);
     if (empty($referencedClass) || !class_exists($referencedClass)) {
         continue;
     }
     $referencedModel = X2Model::model($referencedClass);
     if ($referencedModel->asa('X2LinkableBehavior') instanceof X2LinkableBehavior) {
         // Referenced model exists and is linkable. Update refs:
         $table = $model->tableName();
         $referencedTable = $referencedModel->tableName();
         $column = $field['fieldName'];
         $query = "UPDATE `{$table}` AS `t1`\n                                 INNER JOIN `{$referencedTable}` AS `t2`\n                                 ON CAST(`t1`.`{$column}` AS CHAR)=`t2`.`id`\n                                 SET `t1`.`{$column}`=CAST(`t2`.`nameId` AS CHAR)";
         if ($debug) {
             echo "Running: {$query}\n";
         }
         Yii::app()->db->createCommand($query)->execute();
     }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:31,代码来源:1392142596-migrate-linkfields.php

示例12: array

 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
?>
<div class='stage-member-container stage-member-id-<?php 
echo $data['id'];
?>
 stage-member-type-<?php 
echo $recordType;
?>
'> 

<?php 
$modelName = X2Model::getModelName($recordType);
?>

<div class='stage-icon-container' 
 title='<?php 
echo Yii::t('workflow', '{recordName}', array('{recordName}' => $modelName));
?>
'>
    <img src='<?php 
if (file_exists(substr(Yii::app()->theme->getBaseUrl() . '/images/workflow_stage_' . $recordType . '.png', 1))) {
    echo Yii::app()->theme->getBaseUrl() . '/images/workflow_stage_' . $recordType . '.png';
} else {
    echo Yii::app()->theme->getBaseUrl() . '/images/workflow_stage_model.png';
}
?>
' 
开发者ID:dsyman2,项目名称:X2CRM,代码行数:31,代码来源:_dragAndDropItemView.php

示例13: array

 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
?>
<div class='stage-member-container stage-member-id-<?php 
echo $data['id'];
?>
 stage-member-type-<?php 
echo $data['recordType'];
?>
'> 

<?php 
$modelName = X2Model::getModelName($data['recordType']);
$recordName = $recordNames[$modelName];
?>

<div class='stage-icon-container' 
 title='<?php 
echo Yii::t('workflow', '{recordName}', array('{recordName}' => $recordName));
?>
'>
    <img src='<?php 
echo Yii::app()->theme->getBaseUrl() . '/images/workflow_stage_' . $data['recordType'] . '.png';
?>
' 
     class='stage-member-type-icon left' alt=''>
</div>
<div class='stage-member-name left'><?php 
开发者ID:keyeMyria,项目名称:CRM,代码行数:31,代码来源:_dragAndDropItemView.php

示例14: getStageMembers

 public function getStageMembers($workflowId, $stage, $start, $end, $range, $expectedCloseDateStart, $expectedCloseDateEnd, $expectedCloseDateRange, $users, $modelType = '')
 {
     $params = array();
     $dateRange = self::getDateRange();
     $expectedCloseDateDateRange = self::getDateRange('expectedCloseDateStart', 'expectedCloseDateEnd', 'expectedCloseDateRange');
     if (!is_numeric($workflowId) || !is_numeric($stage)) {
         return new CActiveDataProvider();
     }
     $dataProvider = $this->getStageMemberDataProvider($modelType, $workflowId, $dateRange, $expectedCloseDateDateRange, $stage, $users);
     $gridConfig = array('baseScriptUrl' => Yii::app()->theme->getBaseUrl() . '/css/gridview', 'template' => '<div class="page-title">{title}{buttons}' . '</div>{items}{pager}', 'fixedHeader' => false, 'fullscreen' => false, 'buttons' => array('columnSelector', 'autoResize'));
     $modelName = X2Model::getModelName($modelType);
     $this->renderPartial('_ajaxRequestedStageMembers', array('gridConfig' => array_merge($gridConfig, array('gvSettingsName' => $modelType . '-stageMembers', 'viewName' => $modelType . '-workflowView', 'defaultGvSettings' => array('name' => 125, 'lastUpdated' => 80, 'assignedTo' => 80), 'dataProvider' => $dataProvider, 'id' => 'workflow-stage-grid', 'ajaxUpdate' => 'workflow-stage-grid', 'modelName' => $modelName, 'title' => Modules::displayName(true, $modelType), 'specialColumns' => array('name' => array('name' => 'name', 'header' => Yii::t('app', 'Name'), 'value' => 'X2Model::getModelLinkMock (
                             "' . $modelName . '",
                             $data[\'nameId\'],
                             array (
                                 \'data-qtip-title\' => $data[\'name\']
                             )
                         )', 'type' => 'raw', 'htmlOptions' => array('width' => '30%')), 'lastUpdated' => array('name' => 'lastUpdated', 'header' => X2Model::model($modelName)->getAttributeLabel('lastUpdated'), 'value' => 'Formatter::formatDate($data["lastUpdated"])', 'type' => 'raw', 'htmlOptions' => array('width' => '15%')), 'assignedTo' => array('header' => X2Model::model($modelName)->getAttributeLabel('assignedTo'), 'name' => 'assignedTo', 'value' => 'empty($data["assignedTo"])?' . 'Yii::t("app","Anyone"):User::getUserLinks($data["assignedTo"])', 'type' => 'raw'))))), false, true);
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:19,代码来源:WorkflowController.php

示例15: array

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
            <div class="cell">
                <?php 
echo $form->labelEx($model, 'name');
echo $form->textField($model, 'name', array('maxlength' => 250, 'class' => 'x2-wide-input'));
echo $form->error($model, 'name');
?>
            </div>
            <div class="cell">
                <?php 
$moduleOptions = array(Workflow::DEFAULT_ALL_MODULES => Yii::t('workflow', 'All Modules')) + Modules::getDropdownOptions('id', function ($record) {
    $modelName = X2Model::getModelName($record['name']);
    return $modelName && $modelName::model() instanceof X2Model && $modelName::model()->supportsWorkflow;
});
echo $form->labelEx($model, 'isDefaultFor');
echo $form->dropDownList($model, 'isDefaultFor', $moduleOptions, array('multiple' => 'multiple', 'class' => 'x2-multiselect-dropdown', 'style' => 'display: none', 'data-selected-text' => Yii::t('workflow', 'module(s)')));
?>
            </div>
            <div class="cell">
                <?php 
echo $form->labelEx($model, 'financial');
echo $form->checkBox($model, 'financial');
echo $form->error($model, 'financial');
?>
            </div>
            <div class="cell" id="financialModel" style="<?php 
echo $model->financial ? '' : 'display:none;';
开发者ID:tymiles003,项目名称:X2CRM,代码行数:31,代码来源:_form.php


注:本文中的X2Model::getModelName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。