/** * Get the prefix name of this controller, used for path calculations for element views * * @return string */ protected function getControllerPrefix() { return strtolower(str_replace('Controller', '', Helper::getNSShortname($this))); }
<tr> <th>Name</th> <th>Enabled</th> </tr> </thead> <tbody> <?php foreach ($model_list as $i => $model) { ?> <tr data-attr-id="<?php echo $model->id; ?> " data-attr-name="No Treatment Reason"> <td> <a href="<?php echo Yii::app()->createUrl($this->module->getName() . '/admin/update' . Helper::getNSShortname($model), array('id' => $model->id)); ?> "><?php echo $model->name; ?> </a> </td> <td> <input type="checkbox" class="model_enabled" <?php if ($model->active) { echo "checked"; } ?> /> </td> </tr>
/** * OpenEyes * * (C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011 * (C) OpenEyes Foundation, 2011-2013 * This file is part of OpenEyes. * OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>. * * @package OpenEyes * @link http://www.openeyes.org.uk * @author OpenEyes <*****@*****.**> * @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust * @copyright Copyright (c) 2011-2013, OpenEyes Foundation * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0 */ ?> <div class="box admin"> <?php $form = $this->beginWidget('BaseEventTypeCActiveForm', array('id' => 'OphCiExamination_adminform', 'enableAjaxValidation' => false, 'layoutColumns' => array('label' => 2, 'field' => 5))); $this->renderPartial('form_' . Helper::getNSShortname($model), array('model' => $model, 'form' => $form)); echo $form->formActions(array('submit' => $model->isNewRecord ? 'Create' : 'Save', 'cancel' => 'Cancel', 'delete' => false, 'cancel-uri' => @$cancel_uri)); $this->endWidget(); ?> </div> <?php if (@$related_view) { $this->renderPartial($related_view, array('model' => $model)); }
/** * Update Unique code for the event associated the specific procedures. */ private function updateUniqueCode($event) { foreach ($this->unique_code_elements as $unique) { if ($event->eventType->class_name === $unique['event']) { foreach ($event->getElements() as $element) { if (in_array(Helper::getNSShortname($element), $unique['element'])) { $event_unique_code = UniqueCodeMapping::model()->findAllByAttributes(array('event_id' => $event->id)); if (!$event_unique_code) { $this->createNewUniqueCodeMapping($event->id, null); } } } } } }
/** * Automatic include of various standard assets based on class and module name (including module inheritance) */ protected function registerAssets() { if ($this->assetPath) { $assetManager = Yii::app()->getAssetManager(); $module = $this->getModule(); $paths = array(); foreach (array_reverse($module->getModuleInheritanceList()) as $inherited) { $paths[] = $inherited->name; } $paths[] = $module->name; $controller_name = Helper::getNSShortname($this); foreach ($paths as $p) { $asset_path_alias = 'application.modules.' . $p . '.assets'; // Register module print css if (file_exists(Yii::getPathOfAlias($asset_path_alias . '.css') . '/print.css')) { $assetManager->registerCssFile('css/print.css', $asset_path_alias, null, AssetManager::OUTPUT_PRINT); } // Register module js if (file_exists(Yii::getPathOfAlias($asset_path_alias . '.js') . '/module.js')) { $assetManager->registerScriptFile('js/module.js', $asset_path_alias, 10, AssetManager::OUTPUT_SCREEN); } // Register controller specific js (note for this to work, controllers in child modules must be named the same // as the corresponding controller in the parent module(s) if (file_exists(Yii::getPathOfAlias($asset_path_alias . '.js') . '/' . $controller_name . '.js')) { $assetManager->registerScriptFile('js/' . $controller_name . '.js', $asset_path_alias, 10, AssetManager::OUTPUT_SCREEN); } // Register module css if (file_exists(Yii::getPathOfAlias($asset_path_alias . '.css') . '/module.css')) { $assetManager->registerCssFile('css/module.css', $asset_path_alias, 10, AssetManager::OUTPUT_ALL); } } } }
public function testgetNSShortname() { $test = new HelperTestNS\models\NamespacedElement(); $this->assertEquals('NamespacedElement', Helper::getNSShortname($test)); }
public function testgetNSShortname() { $test = new HelperTestNS\models\HelperTestNS(); $this->assertEquals('HelperTestNS', Helper::getNSShortname($test)); }