예제 #1
0
 public function run()
 {
     $all = Holes::model()->count(array('condition' => 'PREMODERATED=1'));
     $ingibdd = Holes::model()->count(array('condition' => 'PREMODERATED=1 AND STATE="inprogress"'));
     $fixed = Holes::model()->count(array('condition' => 'PREMODERATED=1 AND STATE="fixed"'));
     $this->registerCoreScripts();
     $this->render($this->itemview, array('all' => $all, 'ingibdd' => $ingibdd, 'fixed' => $fixed));
 }
예제 #2
0
 public function run()
 {
     $model = Holes::model()->count(array('condition' => 'PREMODERATED=1'));
     $all = $model;
     $model = Holes::model()->count(array('condition' => 'PREMODERATED=1 AND STATE="inprogress"'));
     $ingibdd = $model;
     $model = Holes::model()->count(array('condition' => 'PREMODERATED=1 AND STATE="fixed"'));
     $fixed = $model;
     $this->registerCoreScripts();
     $this->render($this->itemview, array('all' => Y::declOfNum($all, array('дефект', 'дефекта', 'дефектов')), 'ingibdd' => $ingibdd, 'fixed' => $fixed));
 }
예제 #3
0
 public function getResult($model, $onlyFile = false)
 {
     $_images = array();
     $date3 = $this->application_data ? strtotime($this->application_data) : time();
     if ($this->form_type == 'prosecutor') {
         $date3 = strtotime($this->application_data);
     }
     $date2 = ($this->form_type == 'prosecutor' || $this->form_type == 'prosecutor2') && $model->request_gibdd ? $model->request_gibdd->date_sent : time();
     $_data = array('chief' => $this->to, 'fio' => $this->from, 'address' => $this->postaddress, 'date1.day' => date('d', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'date1.month' => date('m', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'date1.year' => date('Y', $model->DATE_CREATED ? $model->DATE_CREATED : time()), 'street' => $this->address, 'date2.day' => date('d', $date2), 'date2.month' => date('m', $date2), 'date2.year' => date('Y', $date2), 'signature' => $this->signature, 'reason' => $this->comment, 'date3.day' => date('d', $date3), 'date3.month' => date('m', $date3), 'date3.year' => date('Y', $date3), 'gibdd' => $this->gibdd, 'gibdd_reply' => $this->gibdd_reply);
     if ($this->html) {
         foreach ($model->pictures_fresh as $picture) {
             $_images[] = $picture->original;
         }
         header('Content-Type: text/html; charset=utf8', true);
         $HT = new html1234();
         if (!$this->holes) {
             $HT->models = array($model);
             $HT->requestForm = $this;
             $HT->gethtml($this->form_type ? $this->form_type : $model->type, $_data, $_images);
         } else {
             $HT->models = Holes::model()->findAllByPk($this->holes);
             $HT->requestForm = $this;
             $HT->gethtml('gibdd', $_data, array(), $this->printAllPictures);
         }
     } else {
         foreach ($model->pictures_fresh as $picture) {
             $_images[] = $_SERVER['DOCUMENT_ROOT'] . $picture->original;
         }
         $PDF = new pdf1234();
         if (!$this->holes) {
             $PDF->models = array($model);
             $PDF->requestForm = $this;
             $pdfresult = $PDF->getpdf($this->form_type ? $this->form_type : $model->type, $_data, $_images);
         } else {
             $PDF->models = Holes::model()->findAllByPk($this->holes);
             $PDF->requestForm = $this;
             $pdfresult = $PDF->getpdf('gibdd', $_data, array(), $this->printAllPictures);
         }
         if ($this->sendToGibddru && !$onlyFile) {
             $gibdd = isset($PDF->models[0]) && $PDF->models[0]->subject ? $PDF->models[0]->subject->region_num : 0;
             $this->holes = array($model);
             return $this->RequestGibddru($pdfresult, $gibdd);
         } elseif ($this->sendToGibddru && $onlyFile) {
             return $this->savePdfFile($pdfresult);
         }
     }
 }
예제 #4
0
파일: index.php 프로젝트: ASDAFF/RosYama.2
<div class="rCol">
<?php 
if (Yii::app()->user->isModer) {
    ?>
	<?php 
    if ($this->action->id != 'moderPhotoFix') {
        ?>
		<?php 
        echo CHtml::link('Ямы с неотмодерированными фото устраненного дефекта (' . Holes::model()->with('pictures_fixed_not_moderated')->count(array('condition' => 't.deleted=0 AND t.PREMODERATED=1 AND t.STATE!="fixed"')) . ')', array('/holes/moderPhotoFix/'));
        ?>
<br /><br />
	<?php 
    } else {
        ?>
	<h2><?php 
        echo 'Ямы с неотмодерированными фото устраненного дефекта (' . Holes::model()->with('pictures_fixed_not_moderated')->count(array('condition' => 't.deleted=0 AND t.PREMODERATED=1 AND t.STATE!="fixed"')) . ')';
        ?>
</h2>
	<?php 
    }
    ?>
	
<?php 
}
?>
	
<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view', 'itemsTagName' => 'ul', 'cssFile' => '/css/holes_list.css', 'itemsCssClass' => 'holes_list', 'summaryText' => false, 'emptyText' => !$model->archive ? 'Ничего не найдено. Может быть попробовать ' . CHtml::link('поискать в архиве', $model->archiveSearchLink) . '?' : 'Ничего не найдено.', 'viewData' => array('user' => Yii::app()->user), 'afterAjaxUpdate' => 'js:function(id, data) {$(window).scrollTop($(\'.holes_list\').offset().top); noimageMap();}'));
if (Yii::app()->user->isModer && $model->NOT_PREMODERATED && $dataProvider->totalItemCount > 0) {
    ?>
	<input type="button" id="all_right" value="Разрешить все дефекты" />
예제 #5
0
 public function actionAdd($holeid)
 {
     $model = new Payments();
     $holes = Holes::model()->findAllByPk($holeid);
     if (isset($_POST['liqpay'])) {
         $model->attributes = $_POST['Payments'];
         $model->hole_id = $_POST['Payments']['order_id'];
         $model->user_id = Yii::app()->user->id;
         if ($model->save()) {
             $this->redirect(array('done', 'id' => $model->id));
         }
     }
     $this->render('add', array('model' => $model, 'holes' => $holes));
 }
예제 #6
0
 public function actionIndex()
 {
     $limit_sql = !empty($this->arParams['LIMIT']) ? ' limit ' . $this->arParams['LIMIT'] : '';
     //по городам
     $arResult['geography'][] = Holes::model()->findAll(array('select' => 'count(*) as counts, ADR_CITY', 'condition' => 'ADR_CITY!="" and PREMODERATED=1', 'group' => 'trim(ADR_CITY)', 'order' => 'counts desc', 'limit' => 10));
     $arResult['geography'][] = Holes::model()->findAll(array('select' => 'count(*) as counts, ADR_CITY', 'condition' => 'STATE="fixed" and ADR_CITY!="" and PREMODERATED=1', 'group' => 'trim(ADR_CITY)', 'order' => 'counts desc', 'limit' => 10));
     // по статусам
     $arResult['STATE'][] = Holes::model()->findAll(array('select' => 'count(*) as counts, STATE as state_to_filter', 'condition' => 'PREMODERATED=1', 'group' => 'STATE_to_filter', 'order' => 'counts desc', 'limit' => 10));
     $arResult['STATE'][] = Holes::model()->findAll(array('select' => 'avg(DATE_STATUS-DATE_SENT) as time', 'condition' => 'STATE="fixed" and ADR_CITY!="" and PREMODERATED=1', 'limit' => 10));
     // по пользователям
     $arResult['user'][] = Holes::model()->with('user')->findAll(array('select' => 'count(*) as counts', 'condition' => 'PREMODERATED=1', 'group' => 'USER_ID', 'order' => 'counts desc', 'limit' => 10));
     $arResult['user'][] = Holes::model()->with('user')->findAll(array('select' => 'count(*) as counts', 'condition' => 'STATE="fixed" and PREMODERATED=1', 'group' => 'USER_ID', 'order' => 'counts desc', 'limit' => 10));
     $ru = array('fresh' => Yii::t('statics', 'STATE1'), 'achtung' => Yii::t('statics', 'STATE2'), 'inprogress' => Yii::t('statics', 'STATE3'), 'fixed' => Yii::t('statics', 'STATE4'), 'prosecutor' => Yii::t('statics', 'STATE5'), 'gibddre' => Yii::t('statics', 'STATE6'));
     foreach ($arResult['STATE'][0] as $k => $ar) {
         $arResult['STATE'][0][$k]['STATE'] = strtr($ar['state_to_filter'], $ru);
     }
     $num = date('Y', $arResult['STATE'][1][0]['time']) - 1970;
     $tmp = $num != 0 ? $num . $this->declination($num, 'Y') . ', ' : '';
     $num = gmdate('m', $arResult['STATE'][1][0]['time']) - 1;
     $tmp .= $num != 0 ? $num . $this->declination($num, 'm') . ', ' : '';
     $num = gmdate('d', $arResult['STATE'][1][0]['time']) - 1;
     $tmp .= $num != 0 ? $num . $this->declination($num, 'd') . ', ' : '';
     $num = gmdate('H', $arResult['STATE'][1][0]['time']);
     $tmp .= $num != 0 ? $num . $this->declination($num, 'H') . ', ' : '';
     $num = gmdate('i', $arResult['STATE'][1][0]['time']);
     $tmp .= $num != 0 ? $num . $this->declination($num, 'i') . ', ' : '';
     $num = gmdate('s', $arResult['STATE'][1][0]['time']) - 1;
     $tmp .= $num != 0 ? $num . $this->declination($num, 's') . ', ' : '';
     $tmp = substr($tmp, 0, strlen($tmp) - 2);
     $arResult['STATE'][1][0]['time'] = $tmp;
     for ($i = 0; $i < 2; $i++) {
         foreach ($arResult['user'][$i] as $k => $v) {
             $arResult['user'][$i][$k]['user'] = !empty($v->user->name) && !empty($v->user->last_name) ? $v->user->name . ' ' . $v->user->last_name : $v->user->username;
         }
     }
     $this->render('index', array('arResult' => $arResult));
 }
예제 #7
0
 public function loadChangeModel($id)
 {
     $user = $this->auth();
     $model = Holes::model()->findByPk($id);
     if ($model === null) {
         $this->error('NOT_FOUND');
     } elseif ($model->USER_ID != $user->id) {
         $this->error('UNAPPROPRIATE_METHOD');
     }
     return $model;
 }
예제 #8
0
 public function loadChangeModel($id)
 {
     $model = Holes::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     } elseif (!$model->IsUserHole && !Yii::app()->user->level > 80) {
         throw new CHttpException(403, 'Доступ запрещен.');
     }
     return $model;
 }
예제 #9
0
파일: admin.php 프로젝트: ASDAFF/RosYama.2
<?php

$this->breadcrumbs = array('Hole Archive Filters' => array('index'), 'Manage');
$this->menu = array(array('label' => 'Создать правило', '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('hole-archive-filters-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Правила автоматической архивации ям</h1>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'hole-archive-filters-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', 'name', array('name' => 'type_id', 'value' => '$data->type ? $data->type->name : "-"', 'filter' => CHtml::listData(HoleTypes::model()->findAll(array('order' => 'ordering')), 'id', 'name')), array('name' => 'status', 'value' => '$data->status ? $data->status : "-"', 'filter' => Holes::model()->Allstates), array('name' => 'time_to', 'value' => '$data->time_to ? $data->timeSelector[$data->time_to] : "-"', 'filter' => $model->timeSelector), array('class' => 'CButtonColumn'))));
예제 #10
0
파일: _form.php 프로젝트: ASDAFF/RosYama.2
echo $form->labelEx($model, 'type_id');
?>
		<?php 
echo $form->dropDownList($model, 'type_id', CHtml::listData(HoleTypes::model()->findAll(array('order' => 'ordering')), 'id', 'name'), array('prompt' => 'Не выбрано'));
?>
		<?php 
echo $form->error($model, 'type_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'status');
?>
		<?php 
echo $form->dropDownList($model, 'status', Holes::model()->Allstates, array('prompt' => 'Не выбрано'));
?>
		<?php 
echo $form->error($model, 'status');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'time_to');
?>
		<?php 
echo $form->dropDownList($model, 'time_to', $model->timeSelector);
?>
		<?php 
echo $form->error($model, 'time_to');
예제 #11
0
 public function actionPeriods()
 {
     $result = array();
     $firstDate = CDateTimeParser::parse('01.01.' . (date('Y') - 1), 'dd.MM.yyyy');
     $result = Yii::app()->cache->get('period_stat');
     if (!$result) {
         $holes = Holes::model()->findAll(array('select' => 't.DATE_CREATED, t.DATE_SENT, t.DATE_STATUS, t.STATE', 'condition' => 't.DATE_CREATED >=' . $firstDate));
         foreach ($holes as $hole) {
             if (!isset($result[date('Ym', $hole->DATE_CREATED)]['created'])) {
                 $result[date('Ym', $hole->DATE_CREATED)]['created'] = 0;
             } else {
                 $result[date('Ym', $hole->DATE_CREATED)]['created']++;
             }
             if ($hole->DATE_SENT) {
                 if (!isset($result[date('Ym', $hole->DATE_SENT)]['sent'])) {
                     $result[date('Ym', $hole->DATE_SENT)]['sent'] = 0;
                 } else {
                     $result[date('Ym', $hole->DATE_SENT)]['sent']++;
                 }
             }
             if ($hole->STATE == 'fixed' && $hole->DATE_STATUS) {
                 if (!isset($result[date('Ym', $hole->DATE_STATUS)]['fixed'])) {
                     $result[date('Ym', $hole->DATE_STATUS)]['fixed'] = 0;
                 } else {
                     $result[date('Ym', $hole->DATE_STATUS)]['fixed']++;
                 }
             }
         }
         $users = UserGroupsUser::model()->findAll(array('select' => 't.creation_date, t.id as notUseAfrefind', 'condition' => 't.creation_date >= "' . (date('Y') - 1) . '-01-01"'));
         foreach ($users as $user) {
             $time = CDateTimeParser::parse($user->creation_date, 'yyyy-MM-dd HH:mm:ss');
             if (!isset($result[date('Ym', $time)]['users'])) {
                 $result[date('Ym', $time)]['users'] = 0;
             } else {
                 $result[date('Ym', $time)]['users']++;
             }
         }
         Yii::app()->cache->set('period_stat', $result, 3600 * 24);
     }
     $this->render('periods', array('result' => $result, 'firstDate' => $firstDate));
 }
예제 #12
0
 public function actionSaveHoles2Selected($id, $holes)
 {
     if ($id) {
         $gibdd = GibddHeads::model()->findByPk((int) $id);
         $holemodel = Holes::model()->findAllByPk(explode(',', $holes));
         if ($gibdd && $holemodel) {
             $model = new UserSelectedLists();
             $model->user_id = Yii::app()->user->id;
             $model->gibdd_id = $gibdd->id;
             $model->date_created = time();
             $model->holes = $holemodel;
             $model->save();
         }
     }
     $p = Yii::app()->createController('holes');
     $p[0]->actionSelectHoles(false);
 }