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


PHP Time::model方法代码示例

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


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

示例1: loadModel

 /**
  * 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 Time the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Time::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:dieos2,项目名称:bolao,代码行数:15,代码来源:TimeController.php

示例2:

	</div>

	<div class="row">
		 <span>Placar Visitante</span>
		<?php 
echo $form->textField($model, 'placar_visitante');
?>
		<?php 
echo $form->error($model, 'placar_visitante');
?>
	</div>

	<div class="row">
		 <span>Vencedor</span>
		<?php 
echo $form->dropDownList($model, 'vencedor', CHtml::listData(Time::model()->findAll(), 'id', 'nome'));
?>
		<?php 
echo $form->error($model, 'vencedor');
?>
	</div>

	<div class="row">
		 <span>Empate</span>
		<?php 
echo $form->textField($model, 'empate');
?>
		<?php 
echo $form->error($model, 'empate');
?>
	</div>
开发者ID:dieos2,项目名称:bolao,代码行数:31,代码来源:_form.php

示例3: foreach

  <h3 class="w3-regular"><?php 
            echo Yii::t('t', 'Unknown project');
            ?>
</h3>
<?php 
        }
        $tn = 0;
        foreach ($project['allTask'] as $task) {
            if ($tn >= 1) {
                ?>
  <div class="w3-between-boxes-small">&nbsp;</div>
<?php 
            }
            $this->widget('application.components.WGrid', array('displayButtonClose' => true, 'importantRowsBottom' => array(array(array('align' => 'right', 'colspan' => 3, 'content' => Yii::t('math', 'Total')), array('align' => 'right', 'content' => Time::model()->getAttributeView('billedMinute', $task['total']['billedMinute'])), array('align' => 'right', 'content' => Time::model()->getAttributeView('spentMinute', $task['total']['spentMinute']))), array(array('align' => 'right', 'colspan' => 3, 'content' => Yii::t('t', 'Amount')), array('align' => 'right', 'content' => CHtml::encode(MCurrency::format($task['total']['billedAmount']))), array('align' => 'right', 'content' => CHtml::encode(MCurrency::format($task['total']['spentAmount']))))), 'maxRow' => count($task['gridRows']), 'minRow' => count($task['gridRows']) >= 1 ? 1 : 0, 'rows' => $task['gridRows'], 'sColumns' => array(array('title' => Yii::app()->user->checkAccess(User::CLIENT) || Yii::app()->user->checkAccess(User::CONSULTANT) ? Yii::t('t', 'Manager') : Yii::t('t', 'Consultant'), 'width' => 100), array('title' => Yii::t('t', 'Date'), 'width' => 60), array('title' => Yii::t('t', 'Note')), array('nowrap' => true, 'title' => Yii::t('t', 'Billed'), 'width' => 90), array('nowrap' => true, 'title' => Yii::t('t', 'Spent'), 'width' => 90)), 'sGridId' => 'timeGrid' . (isset($task['task']) ? $task['task']->id : microtime(true) * 10000), 'title' => isset($task['task']) ? '<span title="' . Yii::t('t', 'Task') . '">' . CHtml::encode($task['task']->title) . '</span><span class="w3-position-absolute">' . CHtml::link('', array('task/show', 'id' => $task['task']->id), array('class' => 'ui-icon ui-icon-extlink', 'rel' => 'external', 'title' => Yii::t('link', 'Show task'))) . '</span>' : Yii::t('t', 'Unknown task'), 'totalRecords' => count($task['gridRows'])));
            $tn++;
        }
        /*task*/
        ?>
  <div class="w3-between-boxes-small">&nbsp;</div>
<?php 
        $this->widget('application.components.WGrid', array('displaySGrid' => true, 'displaySGridPager' => false, 'importantRowsBottom' => array(array(array('align' => 'right', 'content' => Yii::t('math', 'Total')), array('align' => 'right', 'content' => Time::model()->getAttributeView('billedMinute', $project['total']['billedMinute'])), array('align' => 'right', 'content' => Time::model()->getAttributeView('spentMinute', $project['total']['spentMinute']))), array(array('align' => 'right', 'content' => Yii::t('t', 'Amount')), array('align' => 'right', 'content' => CHtml::encode(MCurrency::format($project['total']['billedAmount']))), array('align' => 'right', 'content' => CHtml::encode(MCurrency::format($project['total']['spentAmount']))))), 'sColumns' => array(array('title' => isset($project['project']) ? $project['project']->title !== '' ? CHtml::encode($project['project']->title) : $project['project']->id : Yii::t('t', 'Unknown project')), array('nowrap' => true, 'title' => Yii::t('t', 'Billed'), 'width' => 90), array('nowrap' => true, 'title' => Yii::t('t', 'Spent'), 'width' => 90)), 'sGridId' => 'projectTotal' . (isset($project['project']) ? $project['project']->id : microtime(true) * 10000), 'title' => Yii::t('t', 'Project')));
        $pn++;
    }
    /*project*/
    ?>
  <div class="w3-between-boxes">&nbsp;</div>
<?php 
    $this->widget('application.components.WGrid', array('displaySGrid' => true, 'displaySGridPager' => false, 'importantRowsBottom' => array(array(array('align' => 'right', 'content' => Yii::t('math', 'Total')), array('align' => 'right', 'content' => Time::model()->getAttributeView('billedMinute', $company['total']['billedMinute'])), array('align' => 'right', 'content' => Time::model()->getAttributeView('spentMinute', $company['total']['spentMinute']))), array(array('align' => 'right', 'content' => Yii::t('t', 'Amount')), array('align' => 'right', 'content' => CHtml::encode(MCurrency::format($company['total']['billedAmount']))), array('align' => 'right', 'content' => CHtml::encode(MCurrency::format($company['total']['spentAmount']))))), 'sColumns' => array(array('title' => isset($company['company']) ? $company['company']->title !== '' ? CHtml::encode($company['company']->title) : $company['company']->id : Yii::t('t', 'Unknown company')), array('nowrap' => true, 'title' => Yii::t('t', 'Billed'), 'width' => 90), array('nowrap' => true, 'title' => Yii::t('t', 'Spent'), 'width' => 90)), 'sGridId' => 'companyTotal' . (isset($company['company']) ? $company['company']->id : microtime(true) * 10000), 'title' => Yii::t('t', 'Company')));
    $cn++;
}
/*company*/
开发者ID:megabr,项目名称:web3cms,代码行数:31,代码来源:report.php

示例4: actionReport

 /**
  * Time report.
  */
 public function actionReport()
 {
     $criteria = new CDbCriteria();
     $criteria->select = "`t`.billedMinute, `t`.spentMinute, `t`.timeDate, `t`.title";
     //$criteria->select="`t`.`billedMinute`, `t`.`spentMinute`, `t`.`timeDate`, `t`.`title`"; // uncomment in yii-1.1.2
     $criteria->condition = "TO_DAYS(`t`.`timeDate`) >= TO_DAYS('2009-09-09')";
     $criteria->order = "`t`.`timeDate` ASC, `t`.`createTime` ASC";
     $with = array('task' => array('select' => 'hourlyRate,title'), 'task.company' => array('select' => 'title'), 'task.project' => array('select' => 'title'));
     if (Yii::app()->user->checkAccess(User::CLIENT)) {
         $with['manager'] = array('select' => 'screenName');
     } else {
         $with['consultant'] = array('select' => 'screenName');
     }
     $models = Time::model()->with($with)->findAll($criteria);
     $data = array();
     foreach ($models as $model) {
         $companyId = isset($model->task->company->id) ? $model->task->company->id : 0;
         if (!isset($data[$companyId]['company']) && isset($model->task->company->id)) {
             $data[$companyId]['company'] = $model->task->company;
         }
         $projectId = isset($model->task->project->id) ? $model->task->project->id : 0;
         if (!isset($data[$companyId]['allProject'][$projectId]['project']) && isset($model->task->project->id)) {
             $data[$companyId]['allProject'][$projectId]['project'] = $model->task->project;
         }
         $taskId = isset($model->task->id) ? $model->task->id : 0;
         if (!isset($data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['task']) && isset($model->task->id)) {
             $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['task'] = $model->task;
         }
         $timeId = $model->id;
         if (Yii::app()->user->checkAccess(User::CLIENT) || Yii::app()->user->checkAccess(User::CONSULTANT)) {
             $member = isset($model->manager->id) ? $model->manager : null;
         } else {
             $member = isset($model->consultant->id) ? $model->consultant : null;
         }
         $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['gridRows'][] = array(array('content' => $member !== null ? CHtml::link($member->screenName !== '' ? CHtml::encode($member->screenName) : $member->id, array('user/show', 'id' => $member->id)) : ''), array('align' => 'right', 'content' => CHtml::encode(MDate::format($model->timeDate, 'short', null)), 'title' => CHtml::encode(MDate::format($model->timeDate, 'full', null))), array('content' => CHtml::link($model->title !== '' ? CHtml::encode($model->title) : $model->id, array('time/show', 'id' => $model->id))), array('align' => 'right', 'content' => $model->getAttributeView('billedMinute'), 'title' => Yii::t('t', 'Hourly rate') . ': ' . (isset($model->task->id) ? (int) $model->task->hourlyRate : '?')), array('align' => 'right', 'content' => $model->getAttributeView('spentMinute'), 'title' => Yii::t('t', 'Hourly rate') . ': ' . (isset($model->task->id) ? (int) $model->task->hourlyRate : '?')));
         if (!isset($data[$companyId]['total']['billedMinute'])) {
             $data[$companyId]['total']['billedMinute'] = 0;
         }
         if (!isset($data[$companyId]['total']['spentMinute'])) {
             $data[$companyId]['total']['spentMinute'] = 0;
         }
         if (!isset($data[$companyId]['total']['billedAmount'])) {
             $data[$companyId]['total']['billedAmount'] = 0;
         }
         if (!isset($data[$companyId]['total']['spentAmount'])) {
             $data[$companyId]['total']['spentAmount'] = 0;
         }
         if (!isset($data[$companyId]['allProject'][$projectId]['total']['billedMinute'])) {
             $data[$companyId]['allProject'][$projectId]['total']['billedMinute'] = 0;
         }
         if (!isset($data[$companyId]['allProject'][$projectId]['total']['spentMinute'])) {
             $data[$companyId]['allProject'][$projectId]['total']['spentMinute'] = 0;
         }
         if (!isset($data[$companyId]['allProject'][$projectId]['total']['billedAmount'])) {
             $data[$companyId]['allProject'][$projectId]['total']['billedAmount'] = 0;
         }
         if (!isset($data[$companyId]['allProject'][$projectId]['total']['spentAmount'])) {
             $data[$companyId]['allProject'][$projectId]['total']['spentAmount'] = 0;
         }
         if (!isset($data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['billedMinute'])) {
             $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['billedMinute'] = 0;
         }
         if (!isset($data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['spentMinute'])) {
             $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['spentMinute'] = 0;
         }
         if (!isset($data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['billedAmount'])) {
             $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['billedAmount'] = 0;
         }
         if (!isset($data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['spentAmount'])) {
             $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['spentAmount'] = 0;
         }
         $data[$companyId]['total']['billedMinute'] += $model->billedMinute;
         $data[$companyId]['total']['spentMinute'] += $model->spentMinute;
         $data[$companyId]['allProject'][$projectId]['total']['billedMinute'] += $model->billedMinute;
         $data[$companyId]['allProject'][$projectId]['total']['spentMinute'] += $model->spentMinute;
         $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['billedMinute'] += $model->billedMinute;
         $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['spentMinute'] += $model->spentMinute;
         if (isset($model->task->id)) {
             $data[$companyId]['total']['billedAmount'] += $model->billedMinute / 60 * (int) $model->task->hourlyRate;
             $data[$companyId]['total']['spentAmount'] += $model->spentMinute / 60 * (int) $model->task->hourlyRate;
             $data[$companyId]['allProject'][$projectId]['total']['billedAmount'] += $model->billedMinute / 60 * (int) $model->task->hourlyRate;
             $data[$companyId]['allProject'][$projectId]['total']['spentAmount'] += $model->spentMinute / 60 * (int) $model->task->hourlyRate;
             $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['billedAmount'] += $model->billedMinute / 60 * (int) $model->task->hourlyRate;
             $data[$companyId]['allProject'][$projectId]['allTask'][$taskId]['total']['spentAmount'] += $model->spentMinute / 60 * (int) $model->task->hourlyRate;
         }
     }
     $this->render($this->action->id, array('data' => $data, 'models' => $models, 'cn', 'pn', 'tn'));
 }
开发者ID:megabr,项目名称:web3cms,代码行数:91,代码来源:TimeController.php

示例5: GetPosicaoTime

 public function GetPosicaoTime($posicao, $grupo)
 {
     $modelGrupo = new Grupo();
     $Criteria = new CDbCriteria();
     $Criteria->condition = "nome = '{$grupo}'";
     $classificacao = array();
     $modelGrupo = Grupo::model()->find($Criteria);
     $Criteria = new CDbCriteria();
     $Criteria->condition = "id_grupo={$modelGrupo->id}";
     $model = GrupoTime::model()->findAll($Criteria);
     foreach ($model as $item) {
         $itemArray = array("id" => $item->id_time, "id_grupo" => $item->id_grupo, "nome" => $item->idTime->nome, "escudo" => $item->idTime->escudo, "pontos" => ConfrontoController::GetPontosDoTime($item->id_time));
         array_push($classificacao, $itemArray);
     }
     $classificacao = ConfrontoController::aasort($classificacao, "pontos");
     $conta = 1;
     foreach ($classificacao as $item) {
         if ($conta == $posicao) {
             $time = Time::model()->findByPk($item["id"]);
         }
         $conta = $conta + 1;
     }
     return $time;
 }
开发者ID:dieos2,项目名称:bolao,代码行数:24,代码来源:ConfrontoController.php

示例6: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     if (isset($_POST['id'])) {
         if (Time::model()->deleteByPk($_POST['id'])) {
             Yii::app()->user->setFlash('status', 'Выбранное время удалено');
         }
     }
     $dataProvider = new CActiveDataProvider('Quests');
     $this->render('index', array('dataProvider' => $dataProvider));
 }
开发者ID:R-thomas,项目名称:quest,代码行数:13,代码来源:QuestsController.php

示例7: actionIndex

 /**
  * Migrate from old project management system.
  */
 public function actionIndex()
 {
     // check rights
     if (!Yii::app()->user->checkAccess(User::ADMINISTRATOR)) {
         throw new CHttpException(403, Yii::t('Yii', 'You are not authorized to perform this action.'));
     }
     // models to migrate
     $migrate = array('User' => false, 'Company' => false, 'CompanyPayment' => false, 'Project' => false, 'Task' => false, 'Time' => true, 'Invoice' => false, 'Expense' => false);
     // start
     $message = '';
     // we won't migrate unless form is submitted
     if (Yii::app()->request->isPostRequest) {
         // default criteria
         $findAllCriteria = new CDbCriteria();
         $findAllCriteria->order = "`id` ASC";
         if ($migrate['User']) {
             // user
             $mUsers = MUser::model()->findAll($findAllCriteria);
             if (is_array($mUsers)) {
                 $i = $j = $c = 0;
                 $accessType = array('customer' => 'client', 'consultant' => 'consultant', 'manager' => 'manager', 'admin' => 'administrator');
                 $accessLevel = array('customer' => 2, 'consultant' => 3, 'manager' => 4, 'admin' => 5);
                 foreach ($mUsers as $oldModel) {
                     if (($model = User::model()->findByPk($oldModel->id)) !== null) {
                         $model->delete();
                     }
                     // old model validation
                     if (User::model()->findByAttributes(array('email' => $oldModel->email))) {
                         $oldModel->email = rand(10, 99) . $oldModel->email;
                     }
                     $closeTime = strtotime($oldModel->close_date);
                     $isActive = empty($oldModel->close_date) || $oldModel->close_date === '0000-00-00' || $closeTime === false;
                     // new model
                     $model = new User('migrate');
                     $model->username = $oldModel->email;
                     $model->password = md5($oldModel->password);
                     $model->email = $oldModel->email;
                     $model->screenName = $oldModel->name;
                     $model->accessType = isset($accessType[$oldModel->class]) ? $accessType[$oldModel->class] : 'member';
                     $model->accessLevel = isset($accessLevel[$oldModel->class]) ? $accessLevel[$oldModel->class] : 1;
                     $model->isActive = $isActive ? '1' : '0';
                     $model->createTime = strtotime($oldModel->last);
                     $model->id = $oldModel->id;
                     if ($model->save()) {
                         $i++;
                         if (($userDetails = UserDetails::model()->findByPk($model->id)) !== null) {
                             $userDetails->delete();
                         }
                         $userDetails = new UserDetails('migrate');
                         $userDetails->emailConfirmationKey = md5(uniqid(rand(), true));
                         $userDetails->initials = $oldModel->inits;
                         $userDetails->occupation = $oldModel->title;
                         $userDetails->deactivationTime = $isActive ? null : $closeTime;
                         $userDetails->administratorNote = '[from migration]';
                         $userDetails->userId = $model->id;
                         $userDetails->save();
                         // relation between user and company
                         if ($oldModel->customer_id >= 1) {
                             $user2Company = new User2Company('migrate');
                             $user2Company->userId = $model->id;
                             $user2Company->companyId = $oldModel->customer_id;
                             $user2Company->position = 'owner';
                             //$oldModel->title
                             if ($user2Company->save()) {
                                 $c++;
                             }
                         }
                     }
                     $j++;
                 }
                 $message .= $i . ' of ' . $j . ' users' . ($i === $c ? '' : ' with ' . $c . ' company (relations)') . ' have been migrated.<br/>';
             }
         }
         if ($migrate['Company']) {
             // company
             $mCustomers = MCustomer::model()->findAll($findAllCriteria);
             if (is_array($mCustomers)) {
                 $i = $j = $l = 0;
                 foreach ($mCustomers as $oldModel) {
                     if (($model = Company::model()->findByPk($oldModel->id)) !== null) {
                         $model->delete();
                     }
                     $closeTime = strtotime($oldModel->close_date);
                     $isActive = empty($oldModel->close_date) || $oldModel->close_date === '0000-00-00' || $closeTime === false;
                     $model = new Company('migrate');
                     $model->title = $oldModel->name;
                     $model->titleAbbr = $oldModel->inits;
                     $model->contactName = $oldModel->contact;
                     $model->contactEmail = $oldModel->contact_email;
                     $model->content = '[from migration]';
                     $model->contentMarkup = 'text';
                     $model->invoiceDueDay = $oldModel->terms_days;
                     $model->isActive = $isActive ? '1' : '0';
                     $model->deactivationTime = $isActive ? null : $closeTime;
                     $model->createTime = strtotime($oldModel->last);
                     $model->id = $oldModel->id;
                     if ($model->save()) {
//.........这里部分代码省略.........
开发者ID:megabr,项目名称:web3cms,代码行数:101,代码来源:MigrateController.php


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