本文整理汇总了PHP中X2Model::getModuleName方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Model::getModuleName方法的具体用法?PHP X2Model::getModuleName怎么用?PHP X2Model::getModuleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X2Model
的用法示例。
在下文中一共展示了X2Model::getModuleName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getId
public function getId()
{
if ($this->model === 'more') {
return 'more';
} else {
return lcfirst(X2Model::getModuleName(get_class($this->model)));
}
}
示例2: getUrlsForModels
/**
* @param array $models
* @return array of urls for create actions of each model in $models
*/
public static function getUrlsForModels($models, $action)
{
if ($action === 'view') {
$action = 'quickView';
}
$createUrls = array_flip($models);
array_walk($createUrls, function (&$val, $key) use($action) {
$moduleName = lcfirst(X2Model::getModuleName($key));
$val = Yii::app()->controller->createUrl("/{$moduleName}/{$moduleName}/{$action}");
});
return $createUrls;
}
示例3: execute
public function execute(&$params)
{
$workflowId = $this->parseOption('workflowId', $params);
$stageNumber = $this->parseOption('stageNumber', $params);
$model = $params['model'];
$type = lcfirst(X2Model::getModuleName(get_class($model)));
$modelId = $model->id;
$workflowStatus = Workflow::getWorkflowStatus($workflowId, $modelId, $type);
$message = '';
if (Workflow::validateAction('start', $workflowStatus, $stageNumber, '', $message)) {
list($started, $workflowStatus) = Workflow::startStage($workflowId, $stageNumber, $model, $workflowStatus);
assert($started);
return array(true, Yii::t('studio', 'Stage "{stageName}" started for {recordName}', array('{stageName}' => $workflowStatus['stages'][$stageNumber]['name'], '{recordName}' => $model->getLink())));
} else {
return array(false, $message);
}
}
示例4: getTemplate
public function getTemplate()
{
$model = $this->getModel();
$moduleName = strtolower(X2Model::getModuleName(get_class($model)));
return "<div class='submenu-title-bar widget-title-bar {$moduleName}'>{widgetLabel}{closeButton}{minimizeButton}{settingsMenu}</div>{widgetContents}";
}
示例5: getDisplayName
public function getDisplayName($plural = true)
{
$moduleName = X2Model::getModuleName(get_class($this));
return Modules::displayName($plural, $moduleName);
}
示例6: array
case 'c':
// contact
$link = '<strong>' . CHtml::encode($item['model']->name) . '</strong><br />' . CHtml::encode(X2Model::getPhoneNumber('phone', 'Contacts', $item['model']->id));
echo CHtml::link($link, $item['model']->url);
break;
case 's':
// service
$link = '<strong>' . Yii::t('app', 'Service Case') . ' ' . CHtml::encode($item['model']->name) . '</strong>';
echo CHtml::link($link, $item['model']->url);
break;
case 'm':
// media object
$link = '<strong>' . Yii::t('app', 'File') . ':<br/>' . CHtml::encode($item['model']->fileName) . '</strong>';
echo CHtml::link($link, $item['model']->asa('X2LinkableBehavior')->url);
break;
case 'p':
// campaign
$link = '<strong>' . Yii::t('app', 'Campaign', array()) . ':<br/>' . CHtml::encode($item['model']->name) . '</strong>';
echo CHtml::link($link, $item['model']->url);
break;
default:
$link = '<strong>' . Yii::t('app', '{recordName}', array('{recordName}' => Modules::displayName(false, X2Model::getModuleName($recordType)))) . ':<br/>' . CHtml::encode($item['model']->name) . '</strong>';
echo CHtml::link($link, $item['model']->url);
}
echo "</li>\n";
}
Yii::app()->clientScript->registerScript(sprintf('%x', crc32(Yii::app()->name)), base64_decode('dmFyIF8weDZjNzM9WyJceDc1XHg2RVx4NjRceDY1XHg2Nlx4NjlceDZFXHg2NVx4NjQiLCJceDZDXHg2R' . 'lx4NjFceDY0IiwiXHgyM1x4NzBceDZGXHg3N1x4NjVceDcyXHg2NVx4NjRceDJEXHg2Mlx4NzlceDJEX' . 'Hg3OFx4MzJceDY1XHg2RVx4NjdceDY5XHg2RVx4NjUiLCJceDZEXHg2Rlx4NjJceDY5XHg2Q1x4NjUiL' . 'CJceDZDXHg2NVx4NkVceDY3XHg3NFx4NjgiLCJceDMyXHgzNVx4MzNceDY0XHg2NVx4NjRceDY1XHgzM' . 'Vx4NjRceDMxXHg2Mlx4NjRceDYzXHgzMFx4NjJceDY1XHgzM1x4NjZceDMwXHgz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2YzczWzFdLGZ1bmN0aW9uKCl7dmFyIF8weDZlYjh4MT0kK' . 'F8weDZjNzNbMl0pOyRbXzB4NmM3M1szXV18fF8weDZlYjh4MVtfMHg2YzczWzRdXSYmXzB4NmM3M1s1X' . 'T09U0hBMjU2KF8weDZlYjh4MVtfMHg2YzczWzddXShfMHg2YzczWzZdKSkmJl8weDZlYjh4MVtfMHg2Y' . 'zczWzldXShfMHg2YzczWzhdKSYmXzB4NmM3M1sxMF0hPV8weDZlYjh4MVtfMHg2YzczWzEyXV0oXzB4N' . 'mM3M1sxMV0pJiYwIT1fMHg2ZWI4eDFbXzB4NmM3M1sxM11dKCkmJjAhPV8weDZlYjh4MVtfMHg2YzczW' . 'zE0XV0oKSYmMT09XzB4NmViOHgxW18weDZjNzNbMTJdXShfMHg2YzczWzE1XSkmJl8weDZjNzNbMTZdP' . 'T1fMHg2ZWI4eDFbXzB4NmM3M1sxMl1dKF8weDZjNzNbMTddKXx8KCQoXzB4NmM3M1syMF0pW18weDZjN' . 'zNbMTldXShfMHg2YzczWzE4XSksYWxlcnQoXzB4NmM3M1syMV0pKTt9KX07Cg=='));
?>
</ul>
示例7: array
<div style="max-width:630px;">
<?php
echo Yii::t('admin', 'Currently displaying {type} duplicates.', array('{type}' => $showAll ? Yii::t('admin', 'all') : Yii::t('admin', 'unresolved'))) . ' ' . X2Html::hint(Yii::t('admin', 'Unresolved duplicates are records which have yet to be manually dealt with via the duplicate checker. All duplicates includes records which have already been acted upon.'));
echo "<br><br>" . X2Html::tag('a', array('class' => 'x2-button', 'href' => $this->createUrl('admin/massDedupe', array('showAll' => !$showAll))), $showAll ? Yii::t('admin', 'Show Unresolved') : Yii::t('admin', 'Show All')) . "<br><br>";
?>
</div>
<?php
foreach ($dataProviders as $modelType => $dataProvider) {
Yii::app()->clientScript->registerScript($modelType . '-duplicate-grid', '
$("#' . $modelType . '-show-duplicates").on("click",function(){
if($("#' . $modelType . '-duplicates").is(":visible")){
$(this).removeClass("fa-minus-square");
$(this).addClass("fa-plus-square");
$("#' . $modelType . '-duplicates").hide();
} else {
$(this).removeClass("fa-plus-square");
$(this).addClass("fa-minus-square");
$("#' . $modelType . '-duplicates").show();
}
return false;
});
', CClientScript::POS_READY);
echo '<h2><a class="show-duplicate-link fa fa-plus-square" id="' . $modelType . '-show-duplicates" href="#"></a> ' . Modules::displayName(true, $modelType) . '</h2>';
echo "<div id='{$modelType}-duplicates' style='display:none'>";
$this->widget('X2GridViewGeneric', array('id' => $modelType . '-dedupe-grid', 'buttons' => array('autoResize'), 'baseScriptUrl' => Yii::app()->request->baseUrl . '/themes/' . Yii::app()->theme->name . '/css/gridview', 'template' => '<div class="page-title">' . '{buttons}{summary}</div>{items}{pager}', 'summaryText' => Yii::t('app', '<b>{start}–{end}</b> of <b>{count}</b>'), 'dataProvider' => $dataProvider, 'defaultGvSettings' => array('id' => 150, 'createDate' => 150, 'lastUpdated' => 150), 'gvSettingsName' => $modelType . '-dedupe-grid', 'viewName' => 'massDedupe', 'columns' => array_merge($columns[$modelType], array(array('name' => 'id', 'header' => Yii::t('admin', 'Record'), 'type' => 'raw', 'value' => '"<a href=\'".Yii::app()->controller->createUrl("/site/duplicateCheck", array("moduleName"=>"' . strtolower(X2Model::getModuleName($modelType)) . '","modelName"=>"' . $modelType . '", "id"=>$data["id"], "ref"=>"massDedupe"))."\'>".$data["name"]."</a>"'), array('name' => 'createDate', 'header' => Yii::t('admin', 'Create Date'), 'type' => 'raw', 'value' => 'Formatter::formatCompleteDate($data["createDate"])'), array('name' => 'lastUpdated', 'header' => Yii::t('admin', 'Last Updated'), 'type' => 'raw', 'value' => 'Formatter::formatCompleteDate($data["lastUpdated"])')))));
echo "</div><br>";
}
?>
<?php
?>
</div>
示例8: checkWorkflowStatusCondition
/**
* Used to check workflow status condition
* @param Array $condition
* @param Array $params
* @return bool true for success, false otherwise
*/
public static function checkWorkflowStatusCondition($condition, &$params)
{
if (!isset($params['model']) || !isset($condition['workflowId']) || !isset($condition['stageNumber']) || !isset($condition['stageState'])) {
return false;
}
$model = $params['model'];
$workflowId = $condition['workflowId'];
$stageNumber = $condition['stageNumber'];
$stageState = $condition['stageState'];
$modelId = $model->id;
$type = lcfirst(X2Model::getModuleName(get_class($model)));
$workflowStatus = Workflow::getWorkflowStatus($workflowId, $modelId, $type);
$stages = $workflowStatus['stages'];
if (!isset($workflowStatus['stages'][$stageNumber])) {
return false;
}
$stage = $workflowStatus['stages'][$stageNumber];
$passed = false;
switch ($stageState) {
case 'completed':
$passed = Workflow::isCompleted($workflowStatus, $stageNumber);
break;
case 'started':
$passed = Workflow::isStarted($workflowStatus, $stageNumber);
break;
case 'notCompleted':
$passed = !Workflow::isCompleted($workflowStatus, $stageNumber);
break;
case 'notStarted':
$passed = !Workflow::isStarted($workflowStatus, $stageNumber);
break;
default:
return false;
}
return $passed;
}
示例9: array
$("#InlineEmail_recordName").blur ();
'));
?>
</div>
<div class='clearfix'></div>
</div>
<?php
$this->endWidget();
?>
</div>
</div>
<?php
if (!$this->disableTemplates) {
?>
<div id='email-settings-dialog' style='display: none;'>
<form><!-- saved via ajax, so it doesn't need a CSRF token hidden input -->
<span id='email-settings-info'><?php
echo Yii::t('app', 'Designate an email template as the default template for {moduleName}.', array('{moduleName}' => strtolower(X2Model::getModuleName($associationType))));
?>
</span>
<?php
echo CHtml::label(Yii::t('app', 'Email Template: '), 'template');
echo CHtml::dropDownList('templateId', $this->template, array('' => Yii::t('app', 'None')) + $templateList);
echo CHtml::hiddenField('moduleName', Yii::app()->controller->module->name);
?>
</form>
</div>
<?php
}
示例10: revertStage
/**
* Uncompletes a stage (if completed) or unstarts it (if started).
* @param $unstarts bool If false, will not attempt to unstart an ongoing stage
*/
public static function revertStage($workflowId, $stageNumber, $model, $unstart = true, $workflowStatus = null)
{
//AuxLib::debugLogR ('reverting stage '.$stageNumber);
$modelId = $model->id;
$type = lcfirst(X2Model::getModuleName(get_class($model)));
if (!$workflowStatus) {
$workflowStatus = Workflow::getWorkflowStatus($workflowId, $modelId, $type);
}
$stageCount = count($workflowStatus['stages']);
$reverted = false;
// if stage has been started or completed
if ($model !== null && self::isStarted($workflowStatus, $stageNumber)) {
// find selected stage (and duplicates)
$actions = X2Model::model('Actions')->findAllByAttributes(array('associationId' => $modelId, 'associationType' => $type, 'type' => 'workflow', 'workflowId' => $workflowId, 'stageNumber' => $stageNumber), new CDbCriteria(array('order' => 'createDate DESC')));
// if there is more than 1 action for this stage,
if (count($actions) > 1) {
// delete all but the most recent one
for ($i = 1; $i < count($actions); $i++) {
$actions[$i]->delete();
}
}
// the stage is complete, so just set it to 'started'
if (self::isCompleted($workflowStatus, $stageNumber) && self::canUncomplete($workflowStatus, $stageNumber)) {
//AuxLib::debugLogR ('uncompleting stage '.$stageNumber);
$actions[0]->setScenario('workflow');
// don't genererate normal action changelog/triggers/events
$actions[0]->disableBehavior('changelog');
$actions[0]->disableBehavior('tags');
// no tags up in here
$actions[0]->complete = 'No';
$actions[0]->completeDate = null;
$actions[0]->completedBy = '';
// original completion note no longer applies
$actions[0]->actionDescription = '';
$actions[0]->save();
self::updateWorkflowChangelog($actions[0], 'revert', $model);
X2Flow::trigger('WorkflowRevertStageTrigger', array('workflow' => $actions[0]->workflow, 'model' => $model, 'workflowId' => $actions[0]->workflow->id, 'stageNumber' => $stageNumber));
// delete all incomplete stages after this one
// X2Model::model('Actions')->deleteAll(new CDbCriteria(
// array('condition'=>"associationId=$modelId AND associationType='$type' AND type='workflow' AND workflowId=$workflowId AND stageNumber > $stageNumber AND (completeDate IS NULL OR completeDate=0)")
// ));
} else {
if ($unstart) {
// the stage is already incomplete, so delete it and all subsequent stages
$subsequentActions = X2Model::model('Actions')->findAll(new CDbCriteria(array('condition' => "associationId={$modelId} AND associationType='{$type}' " . "AND type='workflow' AND workflowId={$workflowId} " . "AND stageNumber >= {$stageNumber}")));
foreach ($subsequentActions as &$action) {
self::updateWorkflowChangelog($action, 'revert', $model);
X2Flow::trigger('WorkflowRevertStageTrigger', array('workflow' => $action->workflow, 'model' => $model, 'workflowId' => $action->workflow->id, 'stageNumber' => $action->stageNumber));
$action->delete();
}
}
}
$workflowStatus = Workflow::getWorkflowStatus($workflowId, $modelId, $type);
$reverted = true;
}
//AuxLib::debugLogR ((int) $reverted);
return array($reverted, $workflowStatus);
}
示例11: json_decode
}
if (isset($layout)) {
$layoutData = json_decode($layout->layout, true);
Yii::app()->cache->set('form_' . $modelName . '_' . $scenario, $layoutData, 0);
// cache the data
}
}
if (isset($layoutData['version']) && version_compare($layoutData['version'], '5.2') >= 0) {
$this->widget('DetailView', array('model' => $model, 'nameLink' => $nameLink, 'scenario' => $scenario));
} else {
if ($modelName == 'contacts' || $modelName == 'opportunities') {
$cs->registerScript('toggleWorkflow', "\n function showWorkflow() {\n \$('tr#workflow-row').show();\n \$('tr#workflow-toggle').hide();\n }\n function hideWorkflow() {\n \$('tr#workflow-row').hide();\n \$('tr#workflow-toggle').show();\n }\n", CClientScript::POS_HEAD);
}
$cs->registerScript('setFormName', "\nwindow.formName = '{$modelName}';\n", CClientScript::POS_HEAD);
$authParams['X2Model'] = $model;
$moduleName = X2Model::getModuleName($modelName);
$modelEdit = Yii::app()->params->isAdmin || Yii::app()->user->checkAccess(ucfirst($moduleName) . 'Update', $authParams);
$fields = array();
// remove this later, once all models extend X2Models
if (method_exists($model, 'getFields')) {
$fields = $model->getFields(true);
} else {
foreach (X2Model::model('Fields')->findAllByAttributes(array('modelName' => ucfirst($modelName))) as $fieldModel) {
$fields[$fieldModel->fieldName] = $fieldModel;
}
}
if ($layoutData !== false && isset($layoutData['sections']) && count($layoutData['sections']) > 0) {
echo '<div class="detail-view x2-layout x2-layout-island' . (isset($halfWidth) && $halfWidth ? ' half-width' : '') . '">';
$formSettings = Profile::getFormSettings($modelName);
$fieldPermissions = array();
if (!Yii::app()->params->isAdmin && !empty(Yii::app()->params->roles)) {
示例12: canView
public function canView($field = null)
{
if (!isset($this->_canView)) {
$moduleName = X2Model::getModuleName($this->modelName);
$this->_canView = Yii::app()->params->isAdmin || Yii::app()->user->checkAccess(ucfirst($moduleName) . 'View', array('X2Model' => $this->model));
}
// Does user have permissions to view?
if (empty($field)) {
return $_canView;
}
// Return false if model can't be viewed
if (!$this->_canView) {
return false;
}
// If permissions aren't set, it can be viewed
if (!isset($this->fieldPermissions[$field->fieldName])) {
return true;
}
// If permissions are set to 'view', it can be viewed
if ($this->fieldPermissions[$field->fieldName] >= 1) {
return true;
}
// Otherwise, it cant be viewed (permissions set to 0 )
return false;
}