当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::model方法代码示例

本文整理汇总了PHP中Component::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::model方法的具体用法?PHP Component::model怎么用?PHP Component::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Component的用法示例。


在下文中一共展示了Component::model方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionPpkPackageChart

 public function actionPpkPackageChart($id, $ppkId)
 {
     $component = Component::model()->findByPk($id);
     $ppk = Ppk::model()->findByPk($ppkId);
     $packageAccounts = PackageAccount::model()->findAllByAttributes(array('component_code' => "{$component->code}", 'ppk_code' => "{$ppk->code}"));
     $packageLists = array();
     if ($packageAccounts) {
         foreach ($packageAccounts as $packageAccount) {
             $package = $packageAccount->package->name;
             if (!in_array($package, $packageLists, true)) {
                 array_push($packageLists, $package);
             }
         }
     }
     $packageIdLists = array();
     if ($packageAccounts) {
         foreach ($packageAccounts as $packageAccount) {
             $packageId = $packageAccount->package->id;
             if (!in_array($packageId, $packageIdLists, true)) {
                 array_push($packageIdLists, $packageId);
             }
         }
     }
     $packageCodes = array();
     if ($packageAccounts) {
         foreach ($packageAccounts as $packageAccount) {
             $code = $packageAccount->package_code;
             if (!in_array($code, $packageCodes, true)) {
                 array_push($packageCodes, $code);
             }
         }
     }
     $limits = array();
     for ($i = 0; $i < count($packageCodes); $i++) {
         $accounts = PackageAccount::model()->findAllByAttributes(array('package_code' => $packageCodes[$i], 'ppk_code' => $ppk->code));
         $limit = 0;
         if ($accounts) {
             foreach ($accounts as $account) {
                 $limit += $account->limit;
             }
             array_push($limits, $limit);
         }
     }
     $realizations = array();
     for ($i = 0; $i < count($packageCodes); $i++) {
         $accounts = PackageAccount::model()->findAllByAttributes(array('package_code' => $packageCodes[$i], 'ppk_code' => $ppk->code));
         $realization = 0;
         if ($accounts) {
             foreach ($accounts as $account) {
                 $realization += $account->getTotal($account->code)['realization'];
             }
             array_push($realizations, $realization);
         }
     }
     $rests = array();
     for ($i = 0; $i < count($packageCodes); $i++) {
         $accounts = PackageAccount::model()->findAllByAttributes(array('package_code' => $packageCodes[$i], 'ppk_code' => $ppk->code));
         $rest = 0;
         if ($accounts) {
             foreach ($accounts as $account) {
                 $rest += $account->getTotal($account->code)['restMoney'];
             }
             array_push($rests, $rest);
         }
     }
     $rates = array();
     for ($i = 0; $i < count($packageCodes); $i++) {
         $accounts = PackageAccount::model()->findAllByAttributes(array('package_code' => $packageCodes[$i], 'ppk_code' => $ppk->code));
         $realization = 0;
         $limit = 0;
         if ($accounts) {
             foreach ($accounts as $account) {
                 $realization += $account->getTotal($account->code)['realization'];
                 $limit += $account->limit;
             }
             $rate = $realization / $limit;
             array_push($rates, $rate);
         } else {
             array_push($rates, 0);
         }
     }
     $this->render('ppkPackageChart', array('ppk' => $ppk, 'packageLists' => $packageLists, 'id' => $packageIdLists, 'limits' => $limits, 'realizations' => $realizations, 'rests' => $rests, 'rates' => $rates));
 }
开发者ID:jimminababan,项目名称:kontrol-anggaran,代码行数:83,代码来源:DashboardController.php

示例2: actionView

 public function actionView($id)
 {
     Yii::app()->session['component'];
     $model = Component::model()->findByPk($id);
     $this->render('view', array('model' => $model));
 }
开发者ID:beingsane,项目名称:joomlacreator,代码行数:6,代码来源:ComponentController.php

示例3: actionExport

 /**
  * Export Data to Excel
  */
 public function actionExport()
 {
     /** Get model */
     $models = Component::model()->findAll();
     /** Error reporting */
     $this->excelErrorReport();
     /** PHPExcel_IOFactory */
     $objReader = new PHPExcel();
     $objReader = PHPExcel_IOFactory::createReader('Excel2007');
     $path = Yii::app()->basePath . '/../export/component.xlsx';
     $pathExport = Yii::app()->basePath . '/../files/Master Komponen.xlsx';
     $objPHPExcel = $objReader->load($path);
     $objPHPExcel->setActiveSheetIndex(0);
     /* " Add new data to template" */
     $this->exportExcel($objPHPExcel, $models);
     /** Export to excel* */
     $this->excel($objPHPExcel, $pathExport);
     readfile($pathExport);
     unlink($pathExport);
     exit;
 }
开发者ID:jimminababan,项目名称:kontrol-anggaran,代码行数:24,代码来源:ComponentController.php

示例4: array

<div class="panel panel-default" style="color: black">
    <div class="panel-header">
        <?php 
/*
 $this->breadcrumbs = array(
 'Subcomponents' => array('index'),
 'Manage',
 );
* 
*/
?>
        <a href="<?php 
echo yii::app()->baseUrl;
?>
/subcomponent/export" class="btn btn-primary"><i class="fa fa fa-download"></i> Export</a>
        <a href="<?php 
echo yii::app()->baseUrl;
?>
/subcomponent/import" class="btn btn-primary"><i class="fa fa fa-upload"></i> Import</a>
        <!--<a href="<?php 
echo yii::app()->baseUrl;
?>
/subcomponent/clear" onclick="return confirm('Yakin ingin menghapus semua data subkomponen?')" class="btn btn-primary"><i class="fa fa fa-trash"></i>Bersihkan Data</a>-->

    </div>
    <div class="panel-body">
        <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'subcomponent-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), array('name' => 'satker_code', 'value' => 'isset($data->satker->name)?$data->satker->name:"Not set"', 'filter' => Satker::model()->getSatkerOptions()), array('name' => 'activity_code', 'value' => 'isset($data->activity->name)?$data->activity->name:"Not set"', 'filter' => Activity::model()->getActivityOptions()), array('name' => 'output_code', 'value' => 'isset($data->outputCode->name)?$data->outputCode->name:$data->output_code', 'filter' => Output::model()->getOutputOptions()), array('name' => 'suboutput_code', 'value' => 'isset($data->suboutputCode->name)?$data->suboutputCode->name:$data->suboutput_code', 'filter' => Suboutput::model()->getSuboutputOptions()), array('name' => 'component_code', 'value' => 'isset($data->componentCode->name)?$data->componentCode->name:$data->component_code', 'filter' => Component::model()->getComponentOptions()), 'code', 'name', array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{view}'))));
?>
    </div>
</div>
开发者ID:jimminababan,项目名称:kontrol-anggaran,代码行数:31,代码来源:index.php

示例5: getComponentOptions

 public function getComponentOptions()
 {
     $models = Component::model()->findAll();
     $options = array();
     foreach ($models as $model) {
         $options[$model->code] = "[{$model->code}] | {$model->name}";
     }
     return $options;
 }
开发者ID:jimminababan,项目名称:kontrol-anggaran,代码行数:9,代码来源:Component.php

示例6: checkMaster

 /**
  * Check completeness data of master
  * @return boolean
  */
 public function checkMaster()
 {
     $complete = false;
     $ppk = Ppk::model()->exists();
     $satker = Satker::model()->exists();
     $activity = Activity::model()->exists();
     $output = Output::model()->exists();
     $suboutput = Suboutput::model()->exists();
     $component = Component::model()->exists();
     $subcomponent = Subcomponent::model()->exists();
     $account = Account::model()->exists();
     $province = Province::model()->exists();
     $city = City::model()->exists();
     if ($ppk && $satker && $activity && $output && $suboutput & $component && $subcomponent && $account && $province && $city) {
         $complete = TRUE;
     }
     return $complete;
 }
开发者ID:jimminababan,项目名称:kontrol-anggaran,代码行数:22,代码来源:DipaController_1.php

示例7: array

<?php 
echo $form->errorSummary($model);
?>

<?php 
echo $form->dropDownListRow($model, "output_code", Output::model()->getOutputOptions(), array("prompt" => "Please Select"));
?>


<?php 
echo $form->dropDownListRow($model, "suboutput_code", Suboutput::model()->getSuboutputOptions(), array("prompt" => "Please Select"));
?>


<?php 
echo $form->dropDownListRow($model, "component_code", Component::model()->getComponentOptions(), array("prompt" => "Please Select"));
?>


<?php 
echo $form->textFieldRow($model, 'code', array('class' => 'span5', 'maxlength' => 256));
?>


<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 256));
?>


<div class="form-actions">
    <?php 
开发者ID:jimminababan,项目名称:kontrol-anggaran,代码行数:31,代码来源:_form.php

示例8: array

<?php

$this->breadcrumbs = array('Budgets' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List Budget', 'url' => array('index')), array('label' => 'Create Budget', '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('budget-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>




<?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'budget-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)'), array('name' => 'dipa_id', 'value' => '$data->dipa->dipa_number', 'filter' => Dipa::model()->getDipaOptions()), array('name' => 'output_code', 'value' => 'isset($data->outputCode->name)?$data->outputCode->name:$data->output_code', 'filter' => Output::model()->getOutputOptions()), array('name' => 'suboutput_code', 'value' => 'isset($data->suboutputCode->name)?$data->suboutputCode->name:$data->suboutput_code', 'filter' => Suboutput::model()->getSuboutputOptions()), array('name' => 'component_code', 'value' => 'isset($data->componentCode->name)?$data->componentCode->name:$data->component_code', 'filter' => Component::model()->getComponentOptions()), array('name' => 'subcomponent_code', 'value' => 'isset($data->subcomponentCode->name)?$data->subcomponentCode->name:$data->subcomponent_code', 'filter' => Subcomponent::model()->getSubcomponentOptions()), 'subcomponent_code', array('name' => 'account_code', 'value' => 'isset($data->accountCode->name)?$data->accountCode->name:$data->account_code', 'filter' => Account::model()->getAccountOptions()), array("name" => "total_budget_limit", "value" => 'Yii::app()->format->number($data->total_budget_limit)', 'htmlOptions' => array('style' => 'text-align: right;')), array('class' => 'bootstrap.widgets.TbButtonColumn'))));
开发者ID:jimminababan,项目名称:kontrol-anggaran,代码行数:12,代码来源:admin.php


注:本文中的Component::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。