</div> </div> <div class="rCol"> <div class="pdf_form" id="pdf_form" style="display: none; left:auto;"> <a href="#" onclick="var c=document.getElementById('pdf_form');if(c){c.style.display=c.style.display=='block'?'none':'block';}return false;" class="close">×</a> <div id="gibdd_form"></div> </div> <p> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'holes_selectors')); ?> <?php echo $form->dropDownList($model, 'TYPE_ID', CHtml::listData(HoleTypes::model()->findAll(array('condition' => 'published=1', 'order' => 'ordering')), 'id', 'name'), array('prompt' => 'Тип дефекта')); ?> <?php echo $form->dropDownList($model, 'STATE', $model->Allstates, array('prompt' => 'Статус дефекта')); ?> <?php echo $form->dropDownList($model, 'showUserHoles', array('3' => 'Все ямы', 1 => 'Мои ямы', 2 => 'Чужие, на которые я отправил заявление')); ?> <?php echo CHtml::submitButton('Найти'); ?> <br/> <?php $this->endWidget(); ?>
"><?php echo $form->checkBox($model, "states[{$alias}]", array('value' => $alias)); ?> </span><ins><?php echo $name; ?> </ins></label> <?php } ?> </div> <div class="filterCol filterType"> <p class="title">Показать тип дефектов</p> <?php foreach (HoleTypes::model()->findAll(array('condition' => 'published=1', 'order' => 'ordering')) as $i => $type) { ?> <label class="col2"><span><?php echo $form->checkBox($model, "types[{$i}]", array('value' => $type->id)); ?> </span><ins class="<?php echo $type->alias; ?> "><?php echo $type->name; ?> </ins></label> <?php } ?> <div class="clear"></div>
public function actionImportHoles() { set_time_limit(0); $holes = BHoles::model()->findAll(); $count = 0; foreach ($holes as $hole) { //if (1){ if ($hole->picturenames && isset($hole->picturenames['medium']['fresh']) && count($hole->picturenames['medium']['fresh']) > 0) { $model = new Holes('import'); $model->attributes = $hole->attributes; $model->ID = $hole->ID; $type = HoleTypes::model()->find('alias = "' . $hole->TYPE . '"'); $model->TYPE_ID = $type->id; if ($model->ADR_SUBJECTRF) { $gibdd = GibddHeads::model()->find('is_regional=1 AND subject_id=' . $model->ADR_SUBJECTRF); if ($gibdd) { $model->gibdd_id = $gibdd->id; } else { $model->gibdd_id = 0; } } else { $model->gibdd_id = 0; } //if ($model->errors) print_r ($model->errors); if ($model->STATE == "inprogress") { if (!$model->DATE_SENT) { $model->DATE_SENT = $model->DATE_CREATED; } //echo date('d.m.Y', $model->DATE_SENT).'<br/>'; } if ($model->save()) { //if (0){ $count++; foreach ($hole->picturenames['medium']['fresh'] as $i => $src) { $picture = new HolePictures(); $picture->type = 'fresh'; $picture->filename = $src; $picture->hole_id = $hole->ID; $picture->user_id = $model->USER_ID; $picture->ordering = $i; $picture->save(); } foreach ($hole->picturenames['medium']['fixed'] as $i => $src) { $picture = new HolePictures(); $picture->type = 'fixed'; $picture->filename = $src; $picture->hole_id = $hole->ID; $picture->user_id = $model->USER_ID; $picture->ordering = $i; $picture->save(); } if ($model->STATE == "fixed") { $fixmodel = new HoleFixeds(); $fixmodel->user_id = $model->USER_ID; $fixmodel->hole_id = $model->ID; $fixmodel->date_fix = $model->DATE_STATUS; $fixmodel->comment = $model->COMMENT2; $fixmodel->save(); } if ($model->STATE != "fresh") { if (!$model->DATE_SENT) { $model->DATE_SENT = $model->DATE_CREATED; } $request = new HoleRequests(); $request->hole_id = $model->ID; $request->user_id = $model->USER_ID; $request->gibdd_id = $model->gibdd_id; $request->date_sent = $model->DATE_SENT; $request->type = 'gibdd'; $request->save(); if ($model->GIBDD_REPLY_RECEIVED) { $answer = new HoleAnswers('import'); //$answer->attributes=Array('uppload_files'=>Array(123,456)); $answer->isimport = true; $answer->request_id = $request->id; $answer->date = $model->DATE_STATUS; $answer->comment = $model->COMMENT_GIBDD_REPLY; if ($answer->save()) { $dir = $_SERVER['DOCUMENT_ROOT'] . $answer->filesFolder; if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/upload/st1234/answers/')) { mkdir($_SERVER['DOCUMENT_ROOT'] . '/upload/st1234/answers/'); } if (!is_dir($_SERVER['DOCUMENT_ROOT'] . '/upload/st1234/answers/' . $answer->request->hole->ID)) { mkdir($_SERVER['DOCUMENT_ROOT'] . '/upload/st1234/answers/' . $answer->request->hole->ID); } if (!is_dir($dir)) { mkdir($dir); } if (!is_dir($dir . '/thumbs')) { mkdir($dir . '/thumbs'); } foreach ($hole->picturenames['medium']['gibddreply'] as $i => $src) { $pict = new HoleAnswerFiles(); $pict->file_name = $src; $pict->file_type = 'image'; $pict->answer_id = $answer->id; copy($_SERVER['DOCUMENT_ROOT'] . '/upload/st1234/original/' . $answer->request->hole->ID . '/' . $src, $dir . '/' . $src); //unlink ($_SERVER['DOCUMENT_ROOT'].'/upload/st1234/original/'.$src); copy($_SERVER['DOCUMENT_ROOT'] . '/upload/st1234/medium/' . $answer->request->hole->ID . '/' . $src, $dir . '/thumbs/' . $src); //unlink ($_SERVER['DOCUMENT_ROOT'].'/upload/st1234/medium/'.$src); $pict->save(); } } else { print_r($answer->errors); die; } } } } } } echo "Добавлено {$count} ям."; }
public function actionHole() { $lang = $this->language; $msg = ""; $model = new Hole(); // uncomment the following code to enable ajax-based validation /* if(isset($_POST['ajax']) && $_POST['ajax']==='hole-hole-form') { echo CActiveForm::validate($model); Yii::app()->end(); } */ if (isset($_POST['Hole'])) { $a = $_POST['Hole']; $reg = Region::model()->findByPk(array('id' => $a['region'], 'lang' => $lang)); $holetype = HoleTypes::model()->findByPk(array('id' => $a['holetype'], 'lang' => $lang)); if ($this->debug) { echo $reg->name . ":" . $holetype->name . "<br>"; } $result = $this->getAllAuth($reg, $holetype, $lang); $msg = $this->renderPartial('holeform', array('result' => $result, 'holetype' => $holetype, 'region' => $reg, 'lang' => $lang, 'hole_id' => 1), true); // return; } if (isset($_POST['Print'])) { $print = $_POST['Print']; $auth = AuthorityType::model()->findByPk(array('lang' => $lang, 'id' => $print['auth']))->alias; $htype = HoleTypes::model()->findByPk(array('lang' => $lang, 'id' => $print['holetype']))->alias; $tmpl = $auth . "_" . $htype . '_' . $print['lang']; $printer = Yii::app()->Printer; if (file_exists(YiiBase::getPathOfAlias($printer->params['templates']) . "/dyplates/{$tmpl}.php")) { $css = file_get_contents(YiiBase::getPathOfAlias($printer->params['templates']) . "/dyplates/" . $auth . "_" . $htype . '.css'); $html = $this->renderFile(YiiBase::getPathOfAlias($printer->params['templates']) . "/dyplates/{$tmpl}.php", array(), true); $outname = "ukryama-" . date("Y-m-d_G-i-s"); echo $printer->printH2P($html, $css, $outname); return; } else { $msg = "Шаблон не найден"; } } $region = Region::model()->findByPk(array("id" => 1, "lang" => $lang)); $holetype = HoleTypes::model()->findAll("lang=:lang", array(":lang" => $lang)); $this->render('hole', array('model' => $model, 'region' => $region, 'holetype' => $holetype, 'msg' => $msg)); }
)); ?> <?php echo $form->errorSummary($model); ?> <? /*<input type="hidden" name="ID" value="<?= $F['ID']['VALUE'] ?>"> if($F['FIX_ID']): ?> <input type="hidden" name="FIX_ID" value="<?= $F['FIX_ID']['VALUE'] ?>"> <? elseif($F['GIBDD_REPLY_ID']): ?> <input type="hidden" name="GIBDD_REPLY_ID" value="<?= $F['GIBDD_REPLY_ID']['VALUE'] ?>"> <? endif;*/ ?> <!-- левая колоночка --> <div class="lCol"> <!-- тип дефекта --> <div class="f"> <?php echo $form->labelEx($model,'TYPE_ID'); ?> <?php echo $form->dropDownList($model, 'TYPE_ID', CHtml::listData( HoleTypes::model()->findAll(Array('condition'=>'published=1', 'order'=>'ordering')), 'id','name')); ?> <?php echo $form->error($model,'TYPE_ID'); ?> </div> <!-- адрес --> <div class="f"> <?php echo $form->labelEx($model,'ADDRESS'); ?> <?php echo $form->textField($model,'ADDRESS',array('class'=>'textInput')); ?> <?php echo $form->error($model,'ADDRESS'); ?> </div> <!-- адрес --> <div class="f"> <?php echo $form->labelEx($model,'gibdd_id'); ?> <?php echo $form->dropDownList($model, 'gibdd_id', CHtml::listData( $model->territorialGibdd, 'id', 'gibdd_name' ));?> <?php echo $form->error($model,'gibdd_id'); ?>
public function actionMap($userid = null) { //$this->layout='//layouts/header_default'; if ($userid) { $usermodel = $this->loadUserModel($userid); if (!$usermodel->getParam('showMyarea')) { throw new CHttpException(403, 'Доступ запрещен.'); } if (!$usermodel->hole_area) { throw new CHttpException(404, 'Зона наблюдения пользователя не определена'); } } else { $usermodel = null; } $model = new Holes('search'); $model->unsetAttributes(); // clear any default values if (isset($_POST['Holes'])) { $model->attributes = $_POST['Holes']; } if ($model->ADR_CITY == "Город") { $model->ADR_CITY = ''; } $this->render('map', array('model' => $model, 'types' => HoleTypes::model()->findAll(array('condition' => 't.published=1', 'order' => 'ordering')), 'usermodel' => $usermodel)); }
public function actionUpdate($id) { $model = $this->loadChangeModel($id); if ($model->STATE != 'fresh') { $this->error('UNAPPROPRIATE_METHOD'); } $address = Yii::app()->request->getParam('address'); $latitude = Yii::app()->request->getParam('latitude'); $longitude = Yii::app()->request->getParam('longitude'); $comment = Yii::app()->request->getParam('comment'); $type = Yii::app()->request->getParam('type'); $deletefiles = Yii::app()->request->getParam('deletefiles'); // $gibdd_id=Yii::app()->request->getParam('gibdd_id'); if ($type) { $typemodel = HoleTypes::model()->find('alias="' . $type . '"'); if (!$typemodel) { $this->error('INCORRECT_TYPE'); } elseif (!$typemodel->published) { $this->error('DEPRECATED_TYPE'); } } if ($address) { /** * $addressArr = RfSubjects::model()->Address($address); * $subject_rf = $addressArr['subject_rf']; */ $city = $addressArr['city']; $address = $addressArr['address']; /** * // ворнинги, если надо * if((!$subject_rf || !$city || !$address) && ($latitude && $longitude)){ * $addressArr = RfSubjects::model()->AddressfromLatLng($latitude, $longitude, $this->mapkey); * if ($addressArr) { * $subject_rf = $addressArr['subject_rf']; * $city = $addressArr['city']; * $address = $addressArr['address']; * } * } */ //if(!$subject_rf) $this->error('CANNOT_REALISE_SUBJECTRF'); if (!$city) { $this->error('CANNOT_REALISE_CITY'); } } $tags = array(); if ($address) { //$model->region_id=$subject_rf; $model->ADR_CITY = trim($city); $model->ADDRESS = trim($address); } if ($latitude) { $model->LATITUDE = $latitude; } if ($longitude) { $model->LONGITUDE = $longitude; } if ($type) { $model->TYPE_ID = $typemodel->id; } if ($comment) { $model->COMMENT1 = $comment; } if ($deletefiles) { $model->deletepict = $deletefiles; } //if ($gibdd_id) $model->gibdd_id=$gibdd_id; $model->validate(); if ($model->getError('upploadedPictures')) { $this->getUploadError($model->getError('upploadedPictures')); } if ($model->save() && $model->savePictures()) { $tags[] = CHtml::tag('callresult', array('result' => 1), 'ok', true); } else { $this->error('CANNOT_UPDATE_DEFECT'); } $this->renderXml($tags); }
<input type="hidden" name="poslat" id="poslat"><input type="hidden" name="poslon" id="poslon"> </tr> <!-- Фотографи --> <tr><td valign="top" id="filez" name="filez">Фото дефекту:</td> <td> <?php $this->widget('CMultiFileUpload', array('accept' => 'gif|jpg|png|jpeg', 'model' => $model, 'attribute' => 'upploadedPictures', 'htmlOptions' => array('class' => 'mf multi'), 'denied' => Yii::t('mf', 'Неможливо завантажити цей файл'), 'duplicate' => Yii::t('mf', 'Файл вже iснує'), 'remove' => Yii::t('mf', 'видалити'), 'selected' => Yii::t('mf', 'Файли: $file'))); ?> </td> <td rowspan=2><a href="http://ukryama.com/"><img width="70px" src="http://ukryama.com/images/logo.png"></a></td></tr> <tr><td colspan=2> <!-- Тип дефекта --> <select style="width:165px" name="deftype" id="deftype" onChange="if(this[0].value=='0')this.remove(0);"> <option value="0">-==Тип дефекту==- <?php $defects = HoleTypes::model()->findAll('published=:stat and lang=:lang', array(':stat' => 1, ':lang' => "ua")); foreach ($defects as $defect) { ?> <option value="<?php echo $defect->id; ?> "><?php echo $defect->name; } ?> </select> <input type="submit" value="Надiслати"></td></tr> </table> </form> <table id="finalPage" style="display:none"> <tr><td><div id="message"></div></td></tr>
<?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'))));
<?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php echo CHtml::beginForm($this->createUrl("itemsSelected"), 'post'); $actionbuttons = ' <i>С отмеченными:</i> <button class="mult_submit" type="submit" name="submit_mult" value="Отмодерировать" title="Отмодерировать"> <img src="/images/b_usrcheck.png" title="Отмодерировать" alt="Отмодерировать" class="icon" width="16" height="16" /></button> <button class="mult_submit" type="submit" name="submit_mult" value="Демодерировать" title="Демодерировать"> <img src="/images/b_usrdrop.png" title="Демодерировать" alt="Демодерировать" class="icon" width="16" height="16" /></button> <button class="mult_submit" type="submit" name="submit_mult" value="Удалить" title="Удалить" onclick="return confirm(\'Вы уверены, что хотите удалить выбранные элементы?\');" > <img src="/images/b_drop.png" title="Удалить" alt="Удалить" class="icon" width="16" height="16" /></button> '; $this->widget('zii.widgets.grid.CGridView', array('id' => 'holes-grid', 'dataProvider' => $model->searchInAdmin(), 'filter' => $model, 'selectableRows' => 2, 'afterAjaxUpdate' => "function(id, data) {\n jQuery('#date_created').datepicker({'dateFormat':'dd.mm.yy'});\n }", 'summaryText' => '<table width="100%"><tr><td style="text-align: left;">' . $actionbuttons . '</td><td style="text-align: right;">Элементы {start}—{end} из {count}.</tr></table>', 'columns' => array(array('class' => 'CCheckBoxColumn', 'id' => 'itemsSelected', 'value' => '$data->ID'), array('name' => 'region_id', 'value' => '$data->subject ? $data->subject->name : "-"'), array('name' => 'username', 'value' => '$data->user->username'), array('name' => 'TYPE_ID', 'value' => '$data->type->name', 'filter' => CHtml::listData(HoleTypes::model()->findAll(), 'id', 'name')), array('name' => 'ROAD_TYPE', 'value' => '$data->roadType', 'filter' => Holes::getAllRoadTypes()), array('name' => 'STATE', 'value' => '$data->stateName', 'filter' => $model->allstates), array('name' => 'DATE_CREATED', 'value' => 'date("d.m.Y H:i", $data->DATE_CREATED)', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'language' => '', 'attribute' => 'DATE_CREATED', 'htmlOptions' => array('class' => 'input date', 'id' => 'date_created'), 'options' => array('dateFormat' => 'dd.mm.yy')), true)), 'ADDRESS', array('name' => 'PREMODERATED', 'type' => 'raw', 'filter' => array(1 => "да", 0 => "нет"), 'value' => '$data->modering'), array('class' => 'CButtonColumn', 'header' => CHtml::dropDownList('pageSize', Yii::app()->user->getState('pageSize', 20), array(10 => 10, 20 => 20, 50 => 50, 100 => 100, 200 => 200), array('class' => 'change-pagesize')))))); echo CHtml::endForm(); ?> <?php Yii::app()->clientScript->registerScript('initPageSize', <<<EOD \$('.change-pagesize').live('change', function() { \$.fn.yiiGridView.update('holes-grid',{ data:{ pageSize: \$(this).val() }}) }); EOD , CClientScript::POS_READY); Yii::app()->clientScript->registerScript('ajaxupdate', "\n\$('#holes-grid a.ajaxupdate').live('click', function() {\n \$.fn.yiiGridView.update('holes-grid', {\n type: 'POST',\n url: \$(this).attr('href'),\n success: function() {\n \$.fn.yiiGridView.update('holes-grid');\n }\n });\n return false;\n});\n\n\$('.mult_submit').live('click', function() {\n \$.fn.yiiGridView.update('holes-grid', {\n type: 'POST',\n url: \$(this).parents('form').attr('action'),\n data: \$(this).parents('form').serialize()+'&submit_mult='+\$(this).val(),\n success: function() {\n \$.fn.yiiGridView.update('holes-grid');\n }\n });\n return false;\n});\n");
public function actionMap() { $this->layout = '//layouts/header_blank'; $model = new Holes('search'); $model->unsetAttributes(); // clear any default values if (isset($_POST['Holes'])) { $model->attributes = $_POST['Holes']; } if ($model->ADR_CITY == "Город") { $model->ADR_CITY = ''; } $hole = new Holes(); //выставляем центр на карте по координатам IP юзера $request = new CHttpRequest(); $geoIp = new EGeoIP(); $geoIp->locate($request->userHostAddress); //echo ($request->userHostAddress); if ($geoIp->longitude) { $hole->LATITUDE = $geoIp->longitude; } if ($geoIp->latitude) { $hole->LONGITUDE = $geoIp->latitude; } $this->render('map', array('model' => $model, 'hole' => $hole, 'types' => HoleTypes::model()->findAll(array('condition' => 't.published=1 and t.lang="ua"')))); }
echo $form->labelEx($model, 'name'); ?> <?php echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'name'); ?> </div> <div class="row"> <?php 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');
public function actionMap() { //$this->layout='//layouts/header_default'; $model = new Holes('search'); $model->unsetAttributes(); // clear any default values if (isset($_POST['Holes'])) { $model->attributes = $_POST['Holes']; } if ($model->ADR_CITY == "Город") { $model->ADR_CITY = ''; } $this->render('map', array('model' => $model, 'types' => HoleTypes::model()->findAll(array('condition' => 't.published=1', 'order' => 'ordering')))); }
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = HoleTypes::model()->findByPk((int) $id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }