示例#1
0
文件: Events.php 项目: shuvro35/X2CRM
 /**
  * Parse an associationType field and resolve the model name
  * @param string $model Model type to resolve
  * @return string Model's name
  */
 public static function parseModelName($model)
 {
     $customModule = Modules::model()->findByAttributes(array('custom' => 1, 'name' => $model));
     if ($customModule) {
         //$model = $customModule->title;
         $model = Modules::itemDisplayName($customModule->name);
         $model = strtolower($model);
     } else {
         switch ($model) {
             case 'Product':
                 $model .= 's';
                 break;
             case 'Quote':
                 $model .= 's';
                 break;
             case 'Opportunity':
                 $model = str_replace('y', 'ies', $model);
                 break;
         }
         $requestedModel = $model;
         $model = Modules::displayName(false, ucfirst($model));
         $model = strtolower($model);
         if (empty($model)) {
             // If the model type couldn't be resolved, check for special cases
             // of models without a dedicated module
             if ($requestedModel === 'AnonContact') {
                 $model = 'anonymous contact';
             } else {
                 if ($requestedModel === 'Campaign') {
                     $model = 'campaign';
                 }
             }
         }
     }
     return Yii::t('app', $model);
 }
示例#2
0
 /**
  * Change the title of a module.
  *
  * This allows for the configuration of the display name of a module. Before
  * version 5.0, this would not affect text other than the top bar menu.
  */
 public function actionRenameModules()
 {
     $order = Modules::model()->findAllByAttributes(array('visible' => 1));
     $menuItems = array();
     $itemNames = array();
     foreach ($order as $module) {
         $menuItems[$module->name] = Yii::t('app', $module->title);
         if ($module->custom || $module->name === 'bugReports') {
             $itemNames[$module->name] = Modules::itemDisplayName($module->name);
         }
     }
     foreach ($menuItems as $key => $value) {
         $menuItems[$key] = preg_replace('/:/', ':', $value);
         // decode any colons
     }
     if (isset($_POST['module']) && isset($_POST['name'])) {
         $module = $_POST['module'];
         $name = $_POST['name'];
         if (empty($module)) {
             Yii::app()->user->setFlash('error', Yii::t('admin', "You must select a module."));
         } else {
             $moduleRecord = Modules::model()->findByAttributes(array('name' => $module, 'title' => $menuItems[$module]));
             if (isset($moduleRecord)) {
                 $match = Modules::model()->findByAttributes(array('title' => $name));
                 $itemName = isset($_POST['itemName']) ? $_POST['itemName'] : "";
                 if (empty($name)) {
                     Yii::app()->user->setFlash('error', Yii::t('admin', "You must specify a title."));
                 } else {
                     if (isset($match) && $match->name !== $moduleRecord->name) {
                         Yii::app()->user->setFlash('error', Yii::t('admin', "A module with this title already exists."));
                     } else {
                         $moduleRecord->title = $name;
                         if (!empty($itemName) && ($moduleRecord->custom || $moduleRecord->name === 'bugReports')) {
                             $moduleRecord->itemName = $itemName;
                         }
                         if ($moduleRecord->retitle($name)) {
                             $this->redirect('index');
                         }
                     }
                 }
             }
         }
     }
     $this->render('renameModules', array('modules' => $menuItems, 'itemNames' => $itemNames));
 }
示例#3
0
文件: create.php 项目: keyeMyria/CRM
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * 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".
 *****************************************************************************************/
include "protected/modules/templates/templatesConfig.php";
$this->actionMenu = $this->formatMenu(array(array('label' => Yii::t('module', '{X} List', array('{X}' => Modules::itemDisplayName())), 'url' => array('index')), array('label' => Yii::t('module', 'Create {X}', array('{X}' => Modules::itemDisplayName())))));
?>
<div class="page-title"><h2><?php 
echo Yii::t('module', 'Create New {X}', array('{X}' => Modules::itemDisplayName()));
?>
</h2></div>

<?php 
echo $this->renderPartial('application.components.views._form', array('model' => $model, 'users' => $users, 'modelName' => 'templates'));
示例#4
0
文件: update.php 项目: dsyman2/X2CRM
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * 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".
 *****************************************************************************************/
include "protected/modules/bugReports/bugReportsConfig.php";
$this->actionMenu = $this->formatMenu(array(array('label' => Yii::t('module', '{X} List', array('{X}' => Modules::itemDisplayName())), 'url' => array('index')), array('label' => Yii::t('module', 'Create {X}', array('{X}' => Modules::itemDisplayName())), 'url' => array('create')), array('label' => Yii::t('module', 'View {X}', array('{X}' => Modules::itemDisplayName())), 'url' => array('view', 'id' => $model->id)), array('label' => Yii::t('module', 'Update {X}', array('{X}' => Modules::itemDisplayName()))), array('label' => Yii::t('module', 'Delete {X}', array('{X}' => Modules::itemDisplayName())), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?')))));
?>
<div class="page-title"><h2><?php 
echo Yii::t('module', 'Update {X}', array('{X}' => Modules::itemDisplayName()));
?>
 #<?php 
echo $model->id;
?>
</h2></div>

<?php 
$this->widget('FormView', array('model' => $model));
//echo $this->renderPartial('application.components.views.@FORMVIEW', array('model'=>$model,'users'=>$users, 'modelName'=>'bugReports'));
示例#5
0
文件: index.php 项目: dsyman2/X2CRM
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * 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".
 *****************************************************************************************/
include "protected/modules/bugReports/bugReportsConfig.php";
$this->actionMenu = $this->formatMenu(array(array('label' => Yii::t('module', '{X} List', array('{X}' => Modules::itemDisplayName()))), array('label' => Yii::t('module', 'Create {X}', array('{X}' => Modules::itemDisplayName())), 'url' => array('create')), array('label' => Yii::t('module', 'Import {X}', array('{X}' => Modules::itemDisplayName())), 'url' => array('admin/importModels', 'model' => ucfirst($moduleConfig['moduleName'])), 'visibility' => Yii::app()->params->isAdmin), array('label' => Yii::t('module', 'Export {X}', array('{X}' => Modules::itemDisplayName())), 'url' => array('admin/exportModels', 'model' => ucfirst($moduleConfig['moduleName'])), 'visibility' => Yii::app()->params->isAdmin)));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('opportunities-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->
<?php 
$this->widget('X2GridView', array('id' => 'bugReports-grid', 'title' => $moduleConfig['title'], 'buttons' => array('advancedSearch', 'clearFilters', 'columnSelector', 'autoResize', 'showHidden'), 'template' => '<div class="page-title">{title}{buttons}{filterHint}{summary}</div>{items}{pager}', 'dataProvider' => $model->searchWithStatusFilter(), 'filter' => $model, 'modelName' => 'bugReports', 'viewName' => 'bugReports', 'defaultGvSettings' => array('subject' => 100, 'severity' => 65, 'status' => 65, 'type' => 65, 'description' => 180, 'assignedTo' => 100), 'specialColumns' => array('name' => array('name' => 'name', 'value' => 'CHtml::link($data->renderAttribute("name"),array("view","id"=>$data->id))', 'type' => 'raw'), 'subject' => array('name' => 'subject', 'value' => 'CHtml::link($data->renderAttribute("subject"),array("view","id"=>$data->id))', 'type' => 'raw'), 'description' => array('name' => 'description', 'header' => Yii::t('app', 'Description'), 'value' => 'Formatter::trimText($data->renderAttribute("description"))', 'type' => 'raw'), 'severity' => array('name' => 'severity', 'header' => Yii::t('app', 'Severity'), 'value' => 'X2Model::model("Dropdowns")->getDropdownValue(116,$data->renderAttribute("severity"))', 'type' => 'raw')), 'enableControls' => true, 'fullscreen' => true));
示例#6
0
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * 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".
 *****************************************************************************************/
include "protected/modules/templates/templatesConfig.php";
$this->actionMenu = $this->formatMenu(array(array('label' => Yii::t('module', '{X} List', array('{X}' => Modules::itemDisplayName())), 'url' => array('index')), array('label' => Yii::t('module', 'Create {X}', array('{X}' => Modules::itemDisplayName())), 'url' => array('create'))));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('templates-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h2><?php 
echo Yii::t('module', 'Manage {X}', array('{X}' => $moduleConfig['title']));
?>
</h2>
<?php 
echo Yii::t('app', 'You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.');
?>
<br />
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>