本文整理汇总了PHP中Jobs::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Jobs::model方法的具体用法?PHP Jobs::model怎么用?PHP Jobs::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jobs
的用法示例。
在下文中一共展示了Jobs::model方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex($oid)
{
$jobs = Jobs::model()->findAll('office_id = :office_id', array(':office_id' => $oid));
$jobs = array_map(create_function('&$item', 'if(isset($item->description) && strlen($item->description) > 600) $item->description = mb_substr($item->description, 0, 600, "utf-8")."..."; return $item;'), $jobs);
Yii::app()->clientScript->registerScript('global_office_id', 'var glOfficeId = ' . $oid . ';', CClientScript::POS_HEAD);
$this->render('/office/jobs/index', array('jobs' => $jobs, 'my_office' => $this->checkMyOffice($oid)));
}
示例2: actionUserList
public function actionUserList()
{
$data = Jobs::model()->findAll(array('select' => 'uid', 'distinct' => true));
$just_users = array();
foreach ($data as $key => $value) {
$just_users[] = $value["uid"];
}
echo CJavaScript::jsonEncode($just_users);
Yii::app()->end();
}
示例3: array
?>
<?php
$models = Categories::model()->findAll();
$list = CHtml::listData($models, 'id', 'cat_name');
echo $form->dropDownList($model, 'category_id', $list, array('empty' => ProjectModule::t('Select a category')));
?>
<?php
echo $form->error($model, 'category_id');
?>
</td>
<td>
<?php
echo $form->labelEx($model, 'job_id');
?>
<?php
$models = Jobs::model()->findAll();
$list = CHtml::listData($models, 'id', 'job_name');
echo $form->dropDownList($model, 'job_id', $list, array('empty' => ProjectModule::t('Select a job')));
?>
<?php
echo $form->error($model, 'job_id');
?>
</td>
</tr>
</table>
<div class="row">
<?php
echo $form->labelEx($model, 'title');
?>
示例4: foreach
<?php
/* @var $this ZakazController */
/* @var $model Zakaz */
$filelist = Yii::app()->fileman->list_files($model->id);
foreach ($filelist as $fd) {
$real_path = Yii::app()->fileman->get_file_path($fd['id'], $fd['file_id']);
$files .= CHtml::link($fd['filename'], array('zakaz/download', 'path' => $real_path)) . ' ';
//echo EDownloadHelper::download($real_path);
}
$this->breadcrumbs = array(ProjectModule::t('Zakazs') => array('index'), $model->title);
?>
<h1><?php
echo ProjectModule::t('View Zakaz');
?>
#<?php
echo $model->id;
?>
</h1>
<?php
if (User::model()->isManager() || User::model()->isAdmin()) {
$attr = array('id', array('name' => 'user_id', 'type' => 'raw', 'value' => User::model()->findByPk($model->user_id)->username), array('name' => 'category_id', 'type' => 'raw', 'value' => Categories::model()->findByPk($model->category_id)->cat_name), array('name' => 'job_id', 'type' => 'raw', 'value' => Jobs::model()->findByPk($model->job_id)->job_name), 'title', 'text', 'date', 'max_exec_date', 'date_finish', 'pages', 'add_demands', array('name' => 'status', 'type' => 'raw', 'value' => $model->status > 0 ? ProjectStatus::model()->findByPk($model->status)->status : null), 'is_payed', 'informed', 'notes');
} else {
$attr = array('id', array('name' => 'user_id', 'type' => 'raw', 'value' => User::model()->findByPk($model->user_id)->username), array('name' => 'category_id', 'type' => 'raw', 'value' => Categories::model()->findByPk($model->category_id)->cat_name), array('name' => 'job_id', 'type' => 'raw', 'value' => $model->job_id > 0 ? Jobs::model()->findByPk($model->job_id)->job_name : null), 'title', 'text', 'date', 'max_exec_date', 'pages', 'add_demands', array('name' => 'status', 'type' => 'raw', 'value' => $model->status > 0 ? ProjectStatus::model()->findByPk($model->status)->status : null));
}
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => $attr));
$this->widget('application.modules.project.widgets.zakazParts.ZakazPartWidget', array('projectId' => $model->id, 'userType' => '1', 'action' => 'show'));
示例5: date
: <?php
echo date("d.m.Y H:i:s", $event->timestamp);
?>
<br>
<?php
echo $attributes['category_id'];
?>
: <?php
echo Categories::model()->findByPk($model->category_id)->cat_name;
?>
<br>
<?php
echo $attributes['job_id'];
?>
: <?php
echo Jobs::model()->findByPk($model->job_id)->job_name;
?>
<br>
<?php
echo $attributes['max_exec_date'];
?>
: <?php
echo $model->dbmax_exec_date;
?>
<br>
<?php
echo $attributes['date_finish'];
?>
: <?php
echo $model->dbdate_finish;
?>
示例6: array
if (Campaign::getId()) {
$columns = array('id', ['name' => 'author_informed', 'value' => Yii::app()->dateFormatter->formatDateTime($order->author_informed)]);
$projectFields = $order->getFields();
if ($projectFields) {
foreach ($projectFields as $field) {
if ($field->field_type == 'LIST') {
$tmp = $field->varname;
$columns[] = ['name' => $field->title, 'type' => 'raw', 'value' => Catalog::model()->findByPk($order->{$tmp})->cat_name];
} else {
$tmp = $field->varname;
$columns[] = ['name' => $field->title, 'value' => $order->{$tmp}];
}
}
}
} else {
$columns = array('id', array('name' => 'category_id', 'type' => 'raw', 'value' => Categories::model()->findByPk($order->category_id)->cat_name), array('name' => 'job_id', 'type' => 'raw', 'value' => $order->job_id > 0 ? Jobs::model()->findByPk($order->job_id)->job_name : null), 'title', 'text', ['name' => 'author_informed', 'value' => Yii::app()->dateFormatter->formatDateTime($order->author_informed)], ['name' => 'date_finish', 'value' => Yii::app()->dateFormatter->formatDateTime($order->date_finish)], 'pages', 'add_demands');
}
$this->widget('zii.widgets.CDetailView', array('data' => $order, 'attributes' => $columns));
echo '<div class="notes-author">';
echo 'Заметки для автора:<br /> ' . $order->getAttribute('author_notes');
echo '</div>';
echo '<div class="materials"><h5>Прикреплённые материалы</h5><ul class="materials-files">' . $html_string . '</ul></div>';
} else {
if ($order->is_active) {
$this->renderPartial('/zakaz/_form', array('model' => $order, 'times' => $times));
} else {
$this->renderPartial('/zakaz/orderInModerate');
}
}
?>
</div>
示例7: array
echo CHtml::link(CHtml::encode($data->id), array('update', 'id' => $data->id));
?>
</td>
<td>
<?php
echo CHtml::encode($data->title);
?>
</td>
<td>
<?php
echo CHtml::encode(User::model()->findByPk($data->user_id)->username);
?>
</td>
<td>
<?php
echo $data->job_id > 0 ? CHtml::encode(Jobs::model()->findByPk($data->job_id)->job_name) : '';
?>
</td>
<td>
<?php
echo CHtml::encode(Categories::model()->findByPk($data->category_id)->cat_name);
?>
</td>
<td>
<?php
echo CHtml::encode(date("Y-m-d H:i", $data->date));
?>
</td>
<td>
<?php
echo CHtml::encode(date("Y-m-d H:i", $data->manager_informed));
示例8: actionEvents
public function actionEvents()
{
$data = array('knights' => null, 'events' => array());
$app_rules_level = AppRulesLevel::model()->findAll(array('index' => 'level'));
//Load knight
//$data['knights']= Knights::model()->with( array('knightsEventsLasts'=>array('order'=>'knightsEventsLasts.date DESC', 'limit'=>Yii::app()->params['events']['event_last']['maximum'] )) )->find( 't.name=:name ', array(':name'=>$_GET['sir']) );
$events_list = KnightsEventsLast::model()->findKnightEventLast($this->knight->id, Yii::app()->params['events']['event_last']['maximum']);
Yii::trace('[CHARACTER][actionEvents] START actionEvents');
if ($events_list) {
//Load knights_status template
//$data['knights_status_template'] = $this->renderFile( Yii::app()->basePath.'/views/character/knights_status.php', array('knight'=>$data['knights']), true );
//Para cada evento cargamos los datos de ese evento.
foreach ($events_list as $event) {
//Check type event.
switch ($event->type) {
//Combate
case KnightsEvents::TYPE_COMBAT:
//Search combat
$combat = Combats::model()->with(array('fromKnight', 'toKnight', array('rounds' => array('order' => 'rounds.number DESC'))))->find('t.id=:id', array(':id' => $event->identificator));
//Make status html
switch ($combat->status) {
case Combats::STATUS_PENDING:
Yii::trace('[CHARACTER][actionEvents] COMBATE PENDIENTE');
//Check if knights are enable for combat
if ($combat->fromKnight->status == Knights::STATUS_ENABLE && $combat->toKnight->status == Knights::STATUS_ENABLE) {
$combatStatusHtml = $this->renderFile(Yii::app()->basePath . '/views/character/event_type_combat_status_pending.php', array('combat' => &$combat), true);
//Check why can not combat
} else {
//Check if somebudy is at combat
if ($combat->fromKnight->status == Knights::STATUS_AT_COMBAT || $combat->toKnight->status == Knights::STATUS_AT_COMBAT) {
$combatStatusHtml = $this->renderFile(Yii::app()->basePath . '/views/character/event_type_combat_status_enable_but_somebody_is_at_combat.php', array('combat' => &$combat), true);
//Check if somebody is at working
} elseif ($combat->fromKnight->status == Knights::STATUS_AT_WORK || $combat->toKnight->status == Knights::STATUS_AT_WORK) {
$combatStatusHtml = $this->renderFile(Yii::app()->basePath . '/views/character/event_type_combat_status_enable_but_somebody_is_at_work.php', array('combat' => &$combat), true);
} elseif ($combat->fromKnight->status == Knights::STATUS_WITHOUT_EQUIPMENT || $combat->toKnight->status == Knights::STATUS_WITHOUT_EQUIPMENT) {
$combatStatusHtml = $this->renderFile(Yii::app()->basePath . '/views/character/event_type_combat_status_enable_but_somebody_is_without_equipment.php', array('combat' => &$combat), true);
}
}
break;
case Combats::STATUS_ENABLE:
$combatStatusHtml = $this->renderFile(Yii::app()->basePath . '/views/character/event_type_combat_status_enable.php', array('combat' => &$combat), true);
/*
//In first round
if( count($combat->rounds)==1 ){
$combatStatusHtml = $this->renderFile( Yii::app()->basePath.'/views/character/event_type_combat_status_enable_accepted_challenge.php', array('combat'=>&$combat ), true );
}else{
//Several rounds
$combatStatusHtml = $this->renderFile( Yii::app()->basePath.'/views/character/event_type_combat_status_enable.php', array('combat'=>&$combat ), true );
}
*/
break;
case Combats::STATUS_FINISHED:
if ($combat->result == Combats::RESULT_REJECT) {
$combatStatusHtml = $this->renderFile(Yii::app()->basePath . '/views/character/event_type_combat_status_finished_result_reject.php', array('combat' => &$combat), true);
} else {
$combatStatusHtml = $this->renderFile(Yii::app()->basePath . '/views/character/event_type_combat_status_enable.php', array('combat' => &$combat), true);
}
break;
}
array_push($data['events'], $this->renderFile(Yii::app()->basePath . '/views/character/event_type_combat.php', array('combat' => &$combat, 'combatStatusHtml' => $combatStatusHtml), true));
break;
//Evolucion de un personaje
//Evolucion de un personaje
case KnightsEvents::TYPE_KNIGHTS_EVOLUTION:
$knightsEventsData = array('knight' => &$data['knights'], 'evolution' => KnightsEvolution::model()->findByPk($event->identificator));
array_push($data['events'], $this->renderFile(Yii::app()->basePath . '/views/character/event_type_knights_evolution.php', $knightsEventsData, true));
break;
case KnightsEvents::TYPE_JOB:
$knightsEventsData = array('knight' => &$data['knights'], 'job' => Jobs::model()->findByPk($event->identificator), 'app_rules_level' => &$app_rules_level);
array_push($data['events'], $this->renderFile(Yii::app()->basePath . '/views/character/event_type_job.php', $knightsEventsData, true));
default:
//Nothing to do here. for example if is void
}
}
//Display
$this->render('events', $data);
} else {
$data['message'] = 'El caballero buscado no existe.';
if ($error = Yii::app()->errorHandler->error) {
$this->render('error', $error);
}
}
}
示例9: actionPayJobs
/**
* This function pay for all jobs in working and date is expired.
* This function is a cronjob. Only use for cron
* Identificator job: 1
*/
public function actionPayJobs()
{
$controlCronJobId = 1;
//Find all jobs for to pay
Yii::trace('[JOBS][actionPayJobs] Pay jobs finished before' . date("Y-m-d H:i:s"));
$jobs_list = Jobs::model()->findAll('status = :status AND date <= :date', array(':status' => Jobs::STATUS_WORKING, 'date' => date("Y-m-d H:i:s")));
Yii::trace('[JOBS][actionPayJobs] Pay jobs (' . count($jobs_list) . ')');
if (count($jobs_list) > 0) {
//Load cache of knights
$app_rule_level = AppRulesLevel::model()->findAll(array('index' => 'level'));
foreach ($jobs_list as $job) {
//Update Knight
$knight = Knights::model()->findByPk($job->knights_id);
$knight->coins += $job->hours * $app_rule_level[$job->knight_level]->cache;
//Check status of knight
if (Inventory::checkIfPrimaryEquipmentIsCompleted($knight->id)) {
$knight->status = Knights::STATUS_ENABLE;
} else {
$knight->status = Knights::STATUS_WITHOUT_EQUIPMENT;
}
if (!$knight->save()) {
Yii::trace('[JOBS][actionPayJobs] No se ha podido actualizar el caballero con sus rupias nuevas.');
}
//Update job
$job->status = Jobs::STATUS_PAYED;
if (!$job->save()) {
Yii::trace('[JOBS][actionPayJobs] No se ha podido actualizar el trabajo con el status "pagado".');
}
//Create event for knight
$event = new KnightsEvents();
$event->attributes = array('knights_id' => $job->knights_id, 'type' => KnightsEvents::TYPE_JOB, 'identificator' => $job->id);
if (!$event->save()) {
Yii::trace('[JOBS][actionPayJobs] No se ha podido guardar un evento nuevo.', 'error');
}
//Update old event
$lastEvent = KnightsEventsLast::getOldLastEvent($job->knights_id);
$lastEvent->type = KnightsEvents::TYPE_JOB;
$lastEvent->identificator = $job->id;
$lastEvent->date = date('Y-m-d H:i:s');
if (!$lastEvent->save()) {
Yii::trace('[JOBS][actionPayJobs] No se ha podido actualizar el último evento más viejo.', 'error');
}
//Update stats and stats by day with coins earned.
$knight_stats = KnightsStats::model()->findByPk($job->knights_id);
if ($knight_stats) {
$knight_stats->money_total_earned += $job->hours * $app_rule_level[$job->knight_level]->cache;
if (!$knight_stats->save()) {
Yii::trace('[JOBS][actionPayJobs] No se han podido actualizar las estadisticas del caballero', 'error');
}
} else {
Yii::trace('[JOBS][actionPayJobs] No hay stats del caballero', 'error');
}
$knight_stats_by_date = KnightsStatsByDate::model()->find('knights_id = :knights_id AND date = :date', array(':knights_id' => $job->knights_id, 'date' => substr($job->date, 0, 10)));
if (!$knight_stats) {
$knight_stats_by_date = new KnightsStatsByDate();
$knight_stats_by_date->attributes = array('knights_id' => $job->knights_id, 'date' => substr($job->date, 0, 10));
}
$knight_stats_by->money_total_earned += $job->hours * $app_rule_level[$job->knight_level]->cache;
if (!$knight_stats_by_date->save()) {
Yii::trace('[JOBS][actionPayJobs] No se han podido actualizar las estadisticas por día del caballero', 'error');
}
}
}
}
示例10: 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 Jobs the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Jobs::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例11: array
// campaign! -------------
if ($field->field_type == "LIST") {
$htmlOptions = array('size' => '10', 'multiple' => 'true', 'style' => 'width:400px;', 'size' => '10', 'empty' => UserModule::t('Use Ctrl for multiply'));
$data = Catalog::model()->performCatsTree($field->varname);
echo CHtml::listBox('Profile[' . $field->varname . ']', array(), $data, $htmlOptions);
// -----------------------
} elseif ($field->varname == 'discipline') {
$htmlOptions = array('size' => '10', 'multiple' => 'true', 'style' => 'width:400px;', 'size' => '10', 'empty' => UserModule::t('Use Ctrl for multiply'));
$data = Categories::model()->performCatsTree();
echo CHtml::listBox('Profile[discipline]', array(), $data, $htmlOptions);
/*echo $form->dropDownList($profile,'discipline',
CHtml::listData(Categories::model()->performCatsTree(), 'id', 'cat_name'),
array('empty'=>UserModule::t('Use Ctrl for multiply'),'multiple'=>true ,'style'=>'width:400px;','size'=>'10'));
*/
} elseif ($field->varname == 'job_type') {
echo $form->dropDownList($profile, 'job_type', CHtml::listData(Jobs::model()->findAll(), 'id', 'job_name'), array('empty' => UserModule::t('Use Ctrl for multiply'), 'multiple' => true, 'style' => 'width:400px;', 'size' => '10'));
} elseif ($widgetEdit = $field->widgetEdit($profile)) {
echo $widgetEdit;
} elseif ($field->range) {
echo $form->dropDownList($profile, $field->varname, Profile::range($field->range), $list);
} elseif ($field->field_type == "TEXT") {
echo $form->textArea($profile, $field->varname, array('rows' => 6, 'cols' => 50));
} else {
echo $form->textField($profile, $field->varname, array('size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255));
}
?>
<?php
//echo $form->error($profile,$field->varname);
?>
</div>
<?php
示例12: actionCancel
/**
* Cancel a jobs. Change status of job to cancelled and is not payed
*/
public function actionCancel()
{
$data = array('errno' => 1, 'error' => '');
//Check input
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0) {
//Find job
if ($job = Jobs::model()->findByPk($_GET['id'])) {
//Check if job belong to knight
if ($job->knights_id == Yii::app()->user->knights_id && $job->status == Jobs::STATUS_WORKING) {
$job->status = Jobs::STATUS_CANCELLED;
if (!$job->save()) {
Yii::trace('[JOBS][actionCancel] El job ' . $job->id . ' no se puede actualizar.', 'error');
}
//Check status of knight
if (Inventory::checkIfPrimaryEquipmentIsCompleted($this->user_data['knights']->id)) {
$this->user_data['knights']->status = Knights::STATUS_ENABLE;
} else {
$this->user_data['knights']->status = Knights::STATUS_WITHOUT_EQUIPMENT;
}
if (!$this->user_data['knights']->save()) {
Yii::trace('[JOBS][actionCancel] No se puede actualizar el status del caballero a disponible', 'error');
}
}
}
}
//Redirect to job
$this->redirect('/jobs');
}
示例13: actionUserList
public function actionUserList($user, $application)
{
$criteria = new CDbCriteria();
$criteria->select = 'uid';
$criteria->distinct = true;
if ($application != "null") {
$criteria->addCondition('appname = ' . $application, 'AND');
}
if ($user != null && sizeof($user > 0)) {
$criteria->addCondition('uid LIKE :uid', 'AND');
}
$criteria->params = array(':uid' => "%{$user}%");
$data = Jobs::model()->findAll($criteria);
$just_users = array();
foreach ($data as $key => $value) {
$just_users[] = $value["uid"];
}
header('Content-Type: application/json; charset="UTF-8"');
echo json_encode($just_users);
Yii::app()->end();
}