Inheritance: extends MX_Controller
コード例 #1
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////////////////////////////// */
HtmlBuilder::start_view_block('head', '', '', '');
$this->insert_meta_tag(array('http-equiv' => "content-type", 'content' => "text/html; charset=UTF-8"));
$this->insert_meta_tag(array('charset' => "utf-8"));
$this->insert_meta_tag(array('name' => "generator", 'content' => "Bootply"));
$this->insert_meta_tag(array('name' => "viewport", 'content' => "width=device-width, initial-scale=1, " . "maximum-scale=1"));
$this->insert_jscript("jquery-1.11.3.min.js");
$this->insert_jscript("bootstrap.min.js");
//$this->insert_jscript("fader.js");
$this->insert_css("bootstrap.min.css");
$this->insert_css("styles.css");
$this->insert_css("carousel.css");
?>
           
 
 <?php 
HtmlBuilder::insert_html_tag('title', '', '', '', DEFAULT_HOSTNAME);
Navbar::init();
Navbar::insert_navbar(DEFAULT_HOSTNAME, '#');
HtmlBuilder::end_view_block('head');
HtmlBuilder::start_view_block('body', '', '', '');
Components::insert_carousel_block();
HtmlBuilder::start_view_block('div', '', 'container', '');
?>
       
コード例 #2
0
ファイル: blocks.php プロジェクト: yunsite/xoopsdc
function spotlight_spotlight_show($options)
{
    xoops_loadlanguage('admin', 'spotlight');
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $block = '';
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        $component_name = $sp_obj->getVar('component_name');
        include_once XOOPS_ROOT_PATH . "/modules/spotlight/class/components.php";
        $com_obj = new Components();
        $block = $com_obj->Show($component_name, $options);
        $block['tpl'] = dirname(dirname(__FILE__)) . "/components/{$component_name}/template.html";
    }
    return $block;
}
コード例 #3
0
ファイル: AdminPagesCreator.php プロジェクト: gingerP/shop
 public function getHtml()
 {
     $html = new Html();
     $head = new Head();
     $head->addChild("\n        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n        <meta http-equiv='cache-control' content='max-age=0' />\n        <meta http-equiv='cache-control' content='no-cache' />\n        <meta http-equiv='expires' content='0' />\n        <meta http-equiv='expires' content='Tue, 01 Jan 1980 1:00:00 GMT' />\n        <meta http-equiv='pragma' content='no-cache' />\n        <link rel='stylesheet' type='text/css' href='/src/front/style/admin-page.css'>\n        ");
     $head->addChild(Components::getMenu());
     $head->addChildList($this->getHeadContent());
     $body = new Body();
     $body->addChildList($this->getGeneralContent());
     return $this->pagePrefix . $html->addChildList([$head, $body])->getHtml();
 }
 public function actionAddtrans()
 {
     if (isset($_POST['component_id'])) {
         //print_r($_POST['id']);
         /*
         			$criteria = new CDbCriteria();			
         			$criteria->join = "JOIN angkutan on(angkutan.id_angkutan = t.id_angkutan)";
         			$criteria->condition = "id_detail = ".$_POST['id'][0];			*/
         $components = Components::model()->findByPk($_POST['component_id']);
         //{"id_detail":"1","nama":"Boeng 757 Jakarta - Surabaya","harga":"350","id_angkutan":"1"}
         $data["component_id"] = $components->id;
         echo CJSON::encode($data);
     }
 }
コード例 #5
0
 public function actionCekcomponents()
 {
     if (strpos($_GET['term'], "(") === false) {
         $condition = $_GET['term'];
         $criteria = new CDbCriteria();
         $criteria->condition = " component_name like '%{$condition}%'";
         $criteria->limit = 7;
         $info = Components::model()->findAll($criteria);
         $arModels = array();
         foreach ($info as $model) {
             $arModels[] = array('id' => $model->id, 'label' => $model->component_name, 'value' => $model->component_name);
         }
         echo CJSON::encode($arModels);
     }
 }
コード例 #6
0
ファイル: confirm.php プロジェクト: ChrisKoivu/PhipMVC

Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), the rights to 
use, copy, modify, merge, publish, or distribute copies of the Software, and to 
permit persons to whom the Software is furnished to do so, subject to the 
following conditions:

The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////////////////////////////// */
include $this->header;
HtmlBuilder::start_view_block('div', '', 'jumbotron', '');
HtmlBuilder::insert_html_tag('h2', '', '', '', $this->get('act_heading'));
HtmlBuilder::insert_html_tag('pgraph', '', '', '', $this->get('output'));
HtmlBuilder::start_view_block('div', '', 'jumbotron', '');
HtmlBuilder::insert_link($this->get('button_link'), '', 'btn btn-info btn-lg', '', '');
Components::insert_glyphicon($this->get('glyph_name'), ' ' . $this->get('button_text'));
HtmlBuilder::end_view_block('a');
HtmlBuilder::end_view_block('div');
include $this->footer;
?>
  
       
コード例 #7
0
 public function sortComponents($position)
 {
     $i = 1;
     foreach ($position as $id) {
         $model = Components::model()->findByPk($id);
         $model->position = $i;
         $model->save();
         $i++;
     }
 }
コード例 #8
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $this->layout = "//layouts/column3";
     $criteria = new CDbCriteria();
     $criteria->join = "JOIN components c ON projectId = t.id JOIN equipment ON componentId = c.id";
     $criteria->order = 't.position';
     $criteria->distinct = true;
     $this->projects = Project::model()->findAll($criteria);
     $criteria2 = new CDbCriteria();
     $criteria2->join = "JOIN equipment ON componentId = t.id";
     $criteria2->distinct = true;
     $this->components = Components::model()->findAll($criteria2);
     $this->render('index', array('query' => Equipment::model()->getEquipmentsForTree(), 'equipments' => Equipment::model()->with('component')->findAll(array('order' => 'projectId, componentId, t.id'))));
 }
コード例 #9
0
ファイル: Caspar.php プロジェクト: thebuggenie/caspar
 /**
  * Performs an action
  * 
  * @param string $module Name of the action
  * @param string $method Name of the action method to run
  */
 public static function performAction($module, $method)
 {
     // Set content variable
     $content = null;
     // Set the template to be used when rendering the html (or other) output
     $template_path = CASPAR_MODULES_PATH . $module . DS . 'templates' . DS;
     // Construct the action class and method name, including any pre- action(s)
     $actionClassName = "\\application\\modules\\{$module}\\Actions";
     $actionToRunName = 'run' . ucfirst($method);
     $preActionToRunName = 'pre' . ucfirst($method);
     // Set up the response object, responsible for controlling any output
     self::getResponse()->setPage(self::getRouting()->getCurrentRouteName());
     self::getResponse()->setTemplate(mb_strtolower($method) . '.' . self::getRequest()->getRequestedFormat() . '.php');
     self::getResponse()->setupResponseContentType(self::getRequest()->getRequestedFormat());
     // Set up the action object
     $actionObject = new $actionClassName();
     // Run the specified action method set if it exists
     if (method_exists($actionObject, $actionToRunName)) {
         // Turning on output buffering
         ob_start('mb_output_handler');
         ob_implicit_flush(0);
         if (self::getRouting()->isCurrentRouteCSRFenabled()) {
             self::checkCSRFtoken(true);
         }
         if (self::$_debug_mode) {
             $time = explode(' ', microtime());
             $pretime = $time[1] + $time[0];
         }
         if ($content === null) {
             Logging::log('Running main pre-execute action');
             // Running any overridden preExecute() method defined for that module
             // or the default empty one provided by Actions
             if ($pre_action_retval = $actionObject->preExecute(self::getRequest(), $method)) {
                 $content = ob_get_clean();
                 Logging::log('preexecute method returned something, skipping further action');
                 if (self::$_debug_mode) {
                     $visited_templatename = "{$actionClassName}::preExecute()";
                 }
             }
         }
         if ($content === null) {
             $action_retval = null;
             if (self::getResponse()->getHttpStatus() == 200) {
                 // Checking for and running action-specific preExecute() function if
                 // it exists
                 if (method_exists($actionObject, $preActionToRunName)) {
                     Logging::log('Running custom pre-execute action');
                     $actionObject->{$preActionToRunName}(self::getRequest(), $method);
                 }
                 // Running main route action
                 Logging::log('Running route action ' . $actionToRunName . '()');
                 if (self::$_debug_mode) {
                     $time = explode(' ', microtime());
                     $action_pretime = $time[1] + $time[0];
                 }
                 $action_retval = $actionObject->{$actionToRunName}(self::getRequest());
                 if (self::$_debug_mode) {
                     $time = explode(' ', microtime());
                     $action_posttime = $time[1] + $time[0];
                     self::visitPartial("{$actionClassName}::{$actionToRunName}", $action_posttime - $action_pretime);
                 }
             }
             if (self::getResponse()->getHttpStatus() == 200 && $action_retval) {
                 // If the action returns *any* output, we're done, and collect the
                 // output to a variable to be outputted in context later
                 $content = ob_get_clean();
                 Logging::log('...done');
             } elseif (!$action_retval) {
                 // If the action doesn't return any output (which it usually doesn't)
                 // we continue on to rendering the template file for that specific action
                 Logging::log('...done');
                 Logging::log('Displaying template');
                 // Check to see if we have a translated version of the template
                 if (!self::getI18n() instanceof I18n || ($templateName = self::getI18n()->hasTranslatedTemplate(self::getResponse()->getTemplate())) === false) {
                     // Check to see if the template has been changed, and whether it's in a
                     // different module, specified by "module/templatename"
                     if (mb_strpos(self::getResponse()->getTemplate(), '/')) {
                         $newPath = explode('/', self::getResponse()->getTemplate());
                         $templateName = CASPAR_MODULES_PATH . $newPath[0] . DS . 'templates' . DS . $newPath[1] . '.' . self::getRequest()->getRequestedFormat() . '.php';
                     } else {
                         $templateName = $template_path . self::getResponse()->getTemplate();
                     }
                 }
                 // Check to see if the template exists and throw an \Exception otherwise
                 if (!file_exists($templateName)) {
                     Logging::log('The template file for the ' . $method . ' action ("' . self::getResponse()->getTemplate() . '") does not exist', 'core', Logging::LEVEL_FATAL);
                     throw new TemplateNotFoundException('The template file for the ' . $method . ' action ("' . self::getResponse()->getTemplate() . '") does not exist');
                 }
                 self::loadLibrary('common');
                 // Present template for current action
                 Components::presentTemplate($templateName, $actionObject->getParameterHolder());
                 $content = ob_get_clean();
                 Logging::log('...completed');
             }
         } elseif (self::$_debug_mode) {
             $time = explode(' ', microtime());
             $posttime = $time[1] + $time[0];
             self::visitPartial($visited_templatename, $posttime - $pretime);
         }
         if (!isset($csp_response)) {
             /**
              * @global Request The request object
              */
             $csp_request = self::getRequest();
             /**
              * @global User The user object
              */
             $csp_user = self::getUser();
             /**
              * @global Response The response object
              */
             $csp_response = self::getResponse();
             /**
              * @global Routing The routing object
              */
             $csp_routing = self::getRouting();
             // Load the "ui" library, since this is used a lot
             self::loadLibrary('ui');
         }
         self::loadLibrary('common');
         Logging::log('rendering content');
         if (self::isMaintenanceModeEnabled() && !mb_strstr(self::getRouting()->getCurrentRouteName(), 'configure')) {
             if (!file_exists(CASPAR_APPLICATION_PATH . 'templates/offline.inc.php')) {
                 throw new TemplateNotFoundException('Can not find offline mode template');
             }
             ob_start('mb_output_handler');
             ob_implicit_flush(0);
             require CASPAR_APPLICATION_PATH . 'templates/offline.inc.php';
             $content = ob_get_clean();
         }
         // Render output in correct order
         self::getResponse()->renderHeaders();
         if (self::getResponse()->getDecoration() == Response::DECORATE_DEFAULT) {
             require \CASPAR_APPLICATION_PATH . 'templates/layout.php';
         } else {
             // Render header template if any, and store the output in a variable
             if (!self::getRequest()->isAjaxCall() && self::getResponse()->doDecorateHeader()) {
                 Logging::log('decorating with header');
                 if (!file_exists(self::getResponse()->getHeaderDecoration())) {
                     throw new TemplateNotFoundException('Can not find header decoration: ' . self::getResponse()->getHeaderDecoration());
                 }
                 require self::getResponse()->getHeaderDecoration();
             }
             echo $content;
             Logging::log('...done (rendering content)');
             // Render footer template if any
             if (!self::getRequest()->isAjaxCall() && self::getResponse()->doDecorateFooter()) {
                 Logging::log('decorating with footer');
                 if (!file_exists(self::getResponse()->getFooterDecoration())) {
                     throw new TemplateNotFoundException('Can not find footer decoration: ' . self::getResponse()->getFooterDecoration());
                 }
                 require self::getResponse()->getFooterDecoration();
             }
             Logging::log('...done');
         }
         if (self::isDebugMode()) {
             self::getI18n()->addMissingStringsToStringsFile();
         }
         return true;
     } else {
         Logging::log("Cannot find the method {$actionToRunName}() in class {$actionClassName}.", 'core', Logging::LEVEL_FATAL);
         throw new ActionNotFoundException("Cannot find the method {$actionToRunName}() in class {$actionClassName}. Make sure the method exists.");
     }
 }
コード例 #10
0
ファイル: TestCase.php プロジェクト: horde/horde
 private function _callStrict(array $parameters)
 {
     Components::main($parameters);
 }
コード例 #11
0
ファイル: index.php プロジェクト: rigidus/cobutilniki
 $url = parse_url($_SERVER['REQUEST_URI']);
 if (isset($url['query'])) {
     parse_str($url['query'], $url['query']);
     if (get_magic_quotes_gpc()) {
         strips($url['query']);
     }
     $aGetQuery = $url['query'];
 } else {
     $aGetQuery = array();
 }
 $sRequest = unslashify($url['path']);
 $nRequest = strlen($sRequest);
 $aRequest = explode('/', $sRequest);
 // libs, нужные в том числе и ядру
 // Components // ***TODO***: Кэшировать в файле алиасы таблиц, чтобы не дергать каждый раз базу
 $Components = new Components();
 foreach ($Components->getAllTablesAndAliases() as $v) {
     $v['alias'] = 'DB_TBL_' . strtoupper($v['alias']);
     if (!defined($v['alias'])) {
         define($v['alias'], $v['name']);
         //dbg($v['alias']);
     }
 }
 // Стартуем сессии - до вывода чего-либо в броузер
 session_start();
 // Stat - мало ли какие ошибки произойдут дальше, а статитистику мы сохраним
 require_once FLGR_COMMON . '/stat.php';
 //if (!defined(LOCALHOST)) {
 //	cStat::bSaveStat();
 //}
 // Cache - незачем крутить код дальше, если есть закешированные данные по этому запросу
コード例 #12
0
ファイル: index.php プロジェクト: ChrisKoivu/PhipMVC
     <!-- Page content  -->
     <?php 
/* ///////////////////////////////////////////////////////////////////////////////////////////////////////////
Copyright (c) June 28, 2015. Christopher M Koivu.


Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), the rights to 
use, copy, modify, merge, publish, or distribute copies of the Software, and to 
permit persons to whom the Software is furnished to do so, subject to the 
following conditions:

The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////////////////////////////// */
include $this->header;
Components::insert_posts_panel(DEFAULT_HOSTNAME, $this->get('posts'));
Components::insert_comment_form();
Components::insert_table($this->get('posts'), 'Records', 'table table-striped', '', 'Posts');
include $this->footer;
?>
  
       
コード例 #13
0
ファイル: index.php プロジェクト: Romandre90/vectortraveler
</h1>

<ul id='treeview' class='filetree'>
    <?php 
$ul = "";
$projectId = 0;
$componentId = 0;
foreach ($query as $q) {
    $pname = $q['pname'];
    $pid = $q['pid'];
    $cname = $q['cname'];
    $cid = $q['cid'];
    $ename = $q['ename'];
    $eid = $q['eid'];
    $project = Project::model()->findByPk($pid);
    $component = Components::model()->findByPk($cid);
    $travelers = Equipment::model()->findByPk($eid)->travelers;
    if ($projectId != $pid) {
        $projectId = $pid;
        $componentId = 0;
        $status = 0;
        echo "{$ul}{$ul}";
        $ul = "";
        if ($project->hide) {
            $style = "";
        } else {
            $style = "style='display:none'";
        }
        ?>
            <li class="p<?php 
        echo $pid;
コード例 #14
0
 public function afterSave()
 {
     $component_id = $this->getAttribute('component_id');
     $stok = intval(Components::model()->findByPk($component_id)->stock);
     $balance = $stok + intval($this->getAttribute('qty'));
     Components::model()->updateByPk($component_id, array('stock' => $balance));
     StockComponents::model()->updateByPk($component_id, array('stock' => $balance));
     $this->updateByPk($this->id_trans, array('balance_history' => $balance));
 }
コード例 #15
0
ファイル: index.php プロジェクト: ChrisKoivu/PhipMVC
<?php

/* ///////////////////////////////////////////////////////////////////////////////////////////////////////////
Copyright (c) June 28, 2015. Christopher M Koivu.


Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), the rights to 
use, copy, modify, merge, publish, or distribute copies of the Software, and to 
permit persons to whom the Software is furnished to do so, subject to the 
following conditions:

The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////////////////////////////// */
include $this->header;
Components::insert_registration_form('registrations', 'register', 'post', 'Sign Up');
include $this->footer;
コード例 #16
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $this->layout = "//layouts/column3";
     $criteria = new CDbCriteria();
     $criteria->join = "JOIN components c ON projectId = t.id JOIN traveler ON componentId = c.id";
     $criteria->order = "t.position";
     $criteria->distinct = true;
     $this->projects = Project::model()->findAll($criteria);
     $criteria2 = new CDbCriteria();
     $criteria2->join = "JOIN traveler ON componentId = t.id";
     $criteria2->distinct = true;
     $this->components = Components::model()->findAll($criteria2);
     $this->render('index', array('query' => Traveler::model()->getTravelerForTree()));
 }
コード例 #17
0
ファイル: admin.php プロジェクト: Romandre90/vectortraveler
<?php

/* @var $this TravelerController */
/* @var $model Traveler */
$this->breadcrumbs = array(Yii::t('default', 'Travelers') => array('index'), Yii::t('default', 'Search'));
$this->menu = array(array('label' => Yii::t('default', 'List Traveler'), 'url' => array('index')), array('label' => Yii::t('default', 'Create Traveler'), 'url' => array('create'), 'visible' => Yii::app()->user->getState('role') > 1));
?>

<h1><?php 
echo Yii::t('default', 'Search Travelers');
?>
</h1>

<p>
    <?php 
echo Yii::t('default', '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.');
?>
</p>


<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'traveler-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'selectableRows' => 1, 'selectionChanged' => 'function(id){ location.href = "' . $this->createUrl('view') . '/id/"+$.fn.yiiGridView.getSelection(id);}', 'columns' => array(array('name' => 'componentId', 'filter' => CHtml::listData(Components::model()->getProjectGroups(), 'id', 'identifier', 'projectIdentifier'), 'value' => 'Components::Model()->FindByPk($data->componentId)->identifier'), 'name', array('name' => 'userId', 'filter' => CHtml::listData(User::model()->findAll(), 'id', 'username'), 'value' => 'User::Model()->FindByPk($data->userId)->username'), 'revision', array('name' => 'status', 'filter' => CHtml::activeDropDownList($model, 'status', $model->statusOptions, array('prompt' => Yii::t('default', ''))), 'value' => '$data->getStatusText()'))));
コード例 #18
0
ファイル: attach.php プロジェクト: Romandre90/vectortraveler
<?php

/* @var $this EquipmentController */
/* @var $model Equipment */
/* @var $form CActiveForm */
?>

<?php 
$this->breadcrumbs = array(Yii::t('default', 'Equipments') => array('equipment/index'), $model->identifier => array('equipment/view', 'id' => $model->id), Yii::t('default', 'Attached Equipments') => array('equipment/attached', 'id' => $model->id), Yii::t('default', 'Attach Equipments'));
$this->menu = array(array('label' => Yii::t('default', 'List Equipment'), 'url' => array('index')), array('label' => Yii::t('default', 'List Assembly'), 'url' => array('assembly')));
Yii::app()->clientScript->registerScript('attach', "\n    \$(':checkbox:checked').each(function(){\n        \$(this).closest('tr').addClass('selected');\n    });\n\$(':checkbox').change(function(){\n    id = \$(this).val();\n    \$.ajax({\n        url: '{$model->id}',\n        type: 'POST',\n        data: 'equipmentId='+id,\n    });\n    \$(this).closest('tr').toggleClass('selected');\n});\n");
?>

<h1><?php 
echo Yii::t('default', 'Attach Equipments');
?>
</h1>

    
    <?php 
$projectId = $model->component->projectId;
$data = $search->search(array('condition' => "t.id NOT IN ({$model->notIn}) AND componentId IN ({$model->inProject}) and (parentId = {$model->id} OR parentId IS NULL)"));
$data->pagination->pageSize = $model->count();
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $data, 'id' => 'equipment-grid', 'selectableRows' => 0, 'enablePagination' => false, 'filter' => $search, 'columns' => array(array('class' => 'CCheckBoxColumn', 'id' => 'chk', 'checked' => '$data->parentId', 'headerTemplate' => '', 'selectableRows' => 2), array('name' => 'componentId', 'filter' => CHtml::listData(Components::model()->findAll("projectId = {$projectId}"), 'id', 'name'), 'value' => 'Components::Model()->FindByPk($data->componentId)->name'), 'identifier', 'description')));
コード例 #19
0
ファイル: login.php プロジェクト: ChrisKoivu/PhipMVC
 	
<?php 
/* ///////////////////////////////////////////////////////////////////////////////////////////////////////////
Copyright (c) June 28, 2015. Christopher M Koivu.


Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), the rights to 
use, copy, modify, merge, publish, or distribute copies of the Software, and to 
permit persons to whom the Software is furnished to do so, subject to the 
following conditions:

The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////////////////////////////// */
include $this->header;
//start_view_block($tagName, $id=NULL, $class=NULL, $style=NULL)
Components::insert_login_form('users', 'login', 'post', 'Log In');
include $this->footer;
コード例 #20
0
ファイル: _form.php プロジェクト: Romandre90/vectortraveler
        echo CHtml::activeDropDownList($model, 'componentId', $data, array('empty' => "--" . Yii::t('default', 'Select a Component') . "--"));
        ?>
            <?php 
        echo $form->error($model, 'componentId');
        ?>
        </div>
        <?php 
    }
    ?>
        <?php 
} elseif ($model->status == 1) {
    ?>
        <div class="row">
            <?php 
    echo $form->labelEx($model, 'componentId');
    $data = CHtml::listData(Components::model()->getProjectGroups(), 'id', 'text', 'group');
    ?>
            <?php 
    echo CHtml::activeDropDownList($model, 'componentId', $data, array('empty' => "--" . Yii::t('default', 'Select a Component') . "--"));
    ?>
            <?php 
    echo $form->error($model, 'componentId');
    ?>
        </div>
        <?php 
}
?>
        <div class="row">
            <?php 
echo $form->labelEx($model, 'name');
?>
コード例 #21
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Components the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Components::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #22
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new ComponentSuplier();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ComponentSuplier'])) {
         $model->attributes = $_POST['ComponentSuplier'];
         if ($model->save()) {
             $price = ComponentSuplier::model()->findAllByAttributes(array('component_id' => $model->component_id));
             if ($price != null) {
                 $i = 0;
                 $price_inc = 0;
                 $rate_price = 0;
                 foreach ($price as $dataprice) {
                     $price_inc = $price_inc + floatval($dataprice->price);
                     $i++;
                     //var_dump($dataprice->price)."<br><br>";
                 }
                 $rate_price = intval($price_inc / $i);
                 Components::model()->updateByPk($model->component_id, array('rate_price' => $rate_price));
             } else {
                 $rate_price = $model->price;
                 Components::model()->updateByPk($model->component_id, array('rate_price' => $rate_price));
             }
             //var_dump($price);
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('index', array('model' => $model));
 }