public static function statusStatistic($addedTimeFrom = null, $addedTimeTo = null) { $result = []; $types = CvList::model()->getStatusTypes(); $command = Yii::app()->db->cache(60)->createCommand()->select('status, count(id) cnt')->from(CvList::model()->tableName())->order("FIELD(status, " . implode(',', array_keys($types)) . ")")->group('status'); if ($addedTimeFrom) { $command->andWhere('added_time >= "' . date('Y-m-d 00:00:00', strtotime($addedTimeFrom)) . '"'); } if ($addedTimeTo) { $command->andWhere('added_time <= "' . date('Y-m-d 23:59:59', strtotime($addedTimeTo)) . '"'); } $command->andWhere('is_active = "' . CvList::IS_ACTIVE_PRESENT . '"'); $rows = $command->queryAll(); if (is_array($rows)) { foreach ($rows as $row) { $result[] = $types[$row['status']] . ": " . $row['cnt']; } } return $result; }
<?php /** * @var $dataProvider CDataProvider */ ?> <p class="lead"> Профілі, в яких не заповнені категорії, можливі посади, місто роботи чи проживання </p> <?php $this->widget('bootstrap.widgets.TbGridView', array('dataProvider' => $dataProvider, 'columns' => [['name' => CvList::model()->getAttributeLabel('first_name'), 'type' => 'raw', 'value' => function (CvList $cvList) { return CHtml::link($cvList->first_name . " " . $cvList->last_name, ['update', 'id' => $cvList->id]); }], ['name' => CvList::model()->getAttributeLabel('status'), 'value' => function (CvList $cvList) { return $cvList->statusTypes[$cvList->status]; }], ['name' => CvList::model()->getAttributeLabel('categoryIds'), 'value' => function (CvList $cvList) { return !empty($cvList->categories) ? '+' : '-'; }], ['name' => CvList::model()->getAttributeLabel('positionsIds'), 'value' => function (CvList $cvList) { return !empty($cvList->positions) ? '+' : '-'; }], ['name' => CvList::model()->getAttributeLabel('jobLocationsIds'), 'value' => function (CvList $cvList) { return !empty($cvList->citiesJobLocations) ? '+' : '-'; }], ['name' => CvList::model()->getAttributeLabel('residenciesIds'), 'value' => function (CvList $cvList) { return !empty($cvList->citiesResidence) ? '+' : '-'; }], ['name' => CvList::model()->getAttributeLabel('recruiter'), 'value' => function (CvList $cvList) { $recruiter = $cvList->recruiter; if (!empty($recruiter)) { return CHtml::link($cvList->recruiter->firstLastName, ['/manage/reqruiter', 'id' => $cvList->recruiter->id]); } return null; }, 'type' => 'raw'], 'added_time:datetime', 'last_update:datetime']));
public function actionExport() { if (sizeof($this->toExport)) { $rows = array(); $items = CvList::model()->getItemsByList($this->toExport); foreach ($items as $item) { $export_item = new ExportItem(); $export_item->id = $item->id; $export_item->first_name = $item->first_name; $export_item->last_name = $item->last_name; $export_item->contact_phone = $item->contact_phone; $export_item->email = $item->email; $export_item->other_contacts = $item->other_contacts; $export_item->desired_position = $item->desired_position; $export_item->desired_place = implode(', ', array_values(CHtml::listData($item->citiesJobLocations, 'city_index', 'city_name'))); $export_item->residencies = implode(', ', array_values(CHtml::listData($item->citiesResidence, 'city_index', 'city_name'))); $export_item->education = $item->educationTypes[$item->education]; $export_item->eduction_info = $item->eduction_info; $export_item->work_experience = $item->work_experience; $export_item->skills = $item->skills; $export_item->driver_licenses = implode(', ', array_values(CHtml::listData($item->driverLicensesTypes, 'id', 'name'))); $export_item->summary = $item->summary; $export_item->gender = $item->genderTypes[$item->gender]; $export_item->marital_status = $item->maritalStatuses[$item->gender][(int) $item->marital_status]; $export_item->birth_date = $item->birth_date; $export_item->documents = $item->documents; $export_item->assistance = $item->flat_assistances; $rows[] = $export_item; } $this->toExcel($rows, array('id', 'first_name', 'last_name', 'contact_phone', 'email', 'other_contacts', 'desired_position', 'desired_place', 'residencies', 'education', 'eduction_info', 'work_experience', 'skills', 'driver_licenses', 'summary', 'gender', 'marital_status', 'birth_date', 'documents', 'assistance'), 'CZVL-profiles-export-' . date('Ymd-His'), array('creator' => 'PHP'), 'Excel2007'); } throw new CHttpException(404, Yii::t('profile', 'Нічого експортувати')); }
]</em> </div> <?php } ?> <?php } ?> </td> <td> <?php if ($data->recruiter) { ?> <strong><?php echo CHtml::encode(CvList::model()->getAttributeLabel('recruiter_id')); ?> :</strong><br /> <?php echo CHtml::link($data->recruiter->firstLastName, array('/manage/reqruiter', 'id' => $data->recruiter->id)); ?> <br /><br /> <?php } ?> <strong><?php echo $data->getAttributeLabel('recruiter_comments'); ?> :</strong><br /> <?php echo $data->recruiter_comments;
<table class="items table"> <thead> <tr> <th style="width: 90px;"><?php echo CHtml::encode(CvList::model()->getAttributeLabel('status')); ?> </th> <th><?php echo CHtml::encode(CvList::model()->getAttributeLabel('first_last_name')); ?> </th> <th style="width: 300px;"></th> <th></th> <th style="width: 250px;"><?php echo CHtml::encode(CvList::model()->getAttributeLabel('desired_position')); ?> </th> <th style="width: 180px;"></th> </tr> </thead> <tbody> <?php $listView = $this->widget('bootstrap.widgets.TbListView', array('dataProvider' => $dataProvider, 'itemView' => '_list')); ?> </tbody> </table> <?php $listView->renderPager(); ?>
public function existentUser($attribute) { if (!empty($this->first_name) && !empty($this->last_name) && !empty($this->contact_phone)) { $this->contact_phone = preg_replace('/[^0-9]/', '', $this->contact_phone); $user = CvList::model()->findByAttributes(array('first_name' => $this->first_name, 'last_name' => $this->last_name, 'contact_phone' => $this->contact_phone)); if (!empty($user)) { $this->addError($attribute, 'Запис з такими данними вже є в базі. Будь ласка не заповнюйте анкету вдруге!'); } } }
/** * @inheritdoc */ protected function beforeSave() { parent::beforeSave(); if ($this->isNewRecord) { $this->operator_id = Yii::app()->user->id; $this->added_time = new CDbExpression('NOW()'); $cv = CvList::model()->findByPk($this->cv_id); $cv->last_update = new CDbExpression('NOW()'); $cv->save(false); } return true; }