/**
  * Validates type of model that triggered the flow
  */
 public function validate(&$params = array(), $flowId = null)
 {
     $model = $params['model'];
     $modelName = get_class($model);
     // ensure that model can be associated with workflows
     if (!$model instanceof X2Model) {
         return array(false, Yii::t('studio', "Processes are not associated with records of this type"));
     } elseif (!$model->supportsWorkflow) {
         return array(false, Yii::t('studio', "{recordName} are not associated with processes", array('{recordName}' => ucfirst(X2Model::getRecordName($modelName)))));
     }
     return parent::validate($params, $flowId);
 }
Esempio n. 2
0
 private function renderSelectAllRecordsOnAllPagesStrip()
 {
     echo '<div class="select-all-records-on-all-pages-strip-container" style="display: none;">
             <div class="select-all-notice">
             ' . Yii::t('app', 'All {count} {recordType} on this page have been selected. ' . '{clickHereLink} to select all {recordType} on all pages.', array('{count}' => '<b>' . $this->dataProvider->itemCount . '</b>', '{clickHereLink}' => '<a class="select-all-records-on-all-pages" href="#">' . Yii::t('app', 'Click here') . '</a>', '{recordType}' => X2Model::getRecordName($this->modelName, true))) . '
             </div>
             <div class="all-selected-notice" style="display: none;">
             ' . Yii::t('app', 'All {recordType} on all pages have been selected ({count} in total). ' . '{clickHereLink} to clear your selection.', array('{count}' => '<b>' . $this->dataProvider->totalItemCount . '</b>', '{clickHereLink}' => '<a class="unselect-all-records-on-all-pages" href="#">' . Yii::t('app', 'Click here') . '</a>', '{recordType}' => X2Model::getRecordName($this->modelName, true))) . '
             </div>
         </div>';
 }
?>
    </ul>
    <?php 
foreach ($massActionObjs as $obj) {
    $obj->renderDialog($gridId, $modelName);
}
?>
</div>

</span>
<?php 
if (isset($modelName)) {
    ?>
<div class='mass-action-dialog double-confirmation-dialog' style='display: none;'>
    <span><?php 
    echo Yii::t('app', 'You are about to delete {count} {recordType}.', array('{recordType}' => X2Model::getRecordName($modelName, true), '{count}' => '<b>' . $gridObj->dataProvider->totalItemCount . '</b>'));
    echo Yii::t('app', 'This action cannot be undone.');
    ?>
        </br>
        </br>
        <?php 
    echo Yii::t('app', 'Please enter your password to confirm that you want to ' . 'delete the selected records.');
    ?>
</span>
    </br>
    </br>
    <?php 
    echo CHtml::label(Yii::t('app', 'Password:'******'LoginForm[password]');
    ?>
    <input name="password" type='password'>
</div>
 /**
  * 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;
 }