示例#1
0
 function before()
 {
     parent::before();
     if (!$this->auth->logged_in()) {
         Message::set(Message::ERROR, 'Доступ закрыт, авторизуйтесь');
         $this->request->redirect('login');
     }
     if (empty($this->user->expires)) {
         $user_expires = new DateTime();
         $user_expires->modify("-1 day");
     } else {
         $user_expires = new DateTime($this->user->expires);
     }
     //  проверка на позможность использования кабинета
     /*if (!$this->allow_expired && Date::diff($user_expires->format("Y-m-d 23:59:59"),date("Y-m-d")) <= 0 ) {
     			Message::set(Message::ERROR, 'Аккаунт заблокирован. Пожалуйста, пополните счет');
     			$this->request->redirect('/cabinet/payment/add');
     		}*/
     if (!empty($this->user->expires)) {
         $exp = Date::diff($user_expires->format("Y-m-d"), date("Y-m-d"), 'days');
         $exp++;
         // текущий день - опказываем как день
         if ($exp >= 0 && $exp <= 5) {
             Message::set(Message::NOTICE, 'Внимание, осталось <strong>' . $exp . " " . MyHelper::morph($exp, "день", "дня", "дней") . ' </strong> использования аккаунтом');
         }
     }
     $this->template->bc['cabinet'] = 'Личный кабиент';
 }
示例#2
0
 function __construct()
 {
     parent::__construct();
     !class_exists('CommunityHelper') and App::import('Helper', 'community');
     $this->Community = ClassRegistry::getClass('CommunityHelper');
     $this->Routes = ClassRegistry::getClass('RoutesHelper');
     $this->Paid = ClassRegistry::getClass('PaidHelper');
     $this->PaidRoutes = ClassRegistry::getClass('PaidRoutesHelper');
 }
示例#3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $link = $request->all();
     $linkInform = file_get_html($link['link']);
     $data['link'] = $link['link'];
     $data['user_id'] = $request->user()->id;
     $data['title'] = $linkInform->find('title', 0)->innertext;
     $tags = $linkInform->find('meta[name="keywords"]', 0);
     $description = $linkInform->find('meta[name="description"]', 0);
     $image = $linkInform->find('meta[property="og:image"]', 0);
     $icon = $linkInform->find('link[rel*="shortcut"]', 0);
     if (!empty($image)) {
         $data['image'] = $image->content;
     }
     if (!empty($icon)) {
         $data['icon'] = $icon->href;
     } else {
         $icon = $linkInform->find('link[rel*="icon"]', 0);
         if (!empty($icon)) {
             $data['icon'] = $icon->href;
         }
     }
     if (!empty($tags)) {
         $data['tags'] = str_limit($tags->content, $limit = 70, $end = '...');
     } elseif (!empty($description)) {
         $data['tags'] = $description->content;
     } else {
         $data['tags'] = '';
     }
     $data['url'] = Helper::url($link['link']);
     if (Link::firstOrCreate($data)) {
         echo 'true';
     } else {
         echo 'false';
     }
 }
示例#4
0
 function action_delete()
 {
     $news = ORM::factory('newsservice', $this->request->param('id', NULL));
     if (!$news->loaded() or $news->user_id != $this->user->id) {
         Message::set(Message::ERROR, Kohana::message('cabinet', 'news_not_found'));
         $this->request->redirect('cabinet');
     }
     if ($_POST) {
         $action = Arr::extract($_POST, array('submit', 'cancel'));
         if ($action['cancel']) {
             $this->request->redirect('cabinet/mews');
         }
         if ($action['submit']) {
             $title = $news->title;
             if ($news->image and file_exists($news->image) and is_writable($news->image)) {
                 unlink($news->image);
                 unlink(MyHelper::get_image_pict_name($news->image));
             }
             $news->delete();
             Message::set(Message::SUCCESS, 'Новость "' . $title . '" удалена');
             $this->request->redirect('cabinet/news');
         }
     }
     $this->view = View::factory('frontend/cabinet/delete')->set('url', 'cabinet/news/delete/' . $news->id)->set('text', 'Вы действительно хотите удалить новость ' . $news->title);
     $this->template->title = $this->site_name . 'Удаление новости';
     $this->template->bc['#'] = 'Удаление новости';
     $this->template->content = $this->view;
 }
示例#5
0
						<?php 
echo CHtml::activeDropDownList($model, 'language_id', CHtml::listData(ReferenceLanguages::model()->byOrder()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select'));
?>
						<?php 
echo CHtml::error($model, 'language_id');
?>
					</div>
				</div>

				<div class="form-group">
					<?php 
echo CHtml::activeLabelEx($model, 'level', array('class' => $label_class));
?>
					<div class="col-md-6 col-xs-12">                                                                                                                                           
						<?php 
echo CHtml::activeRadioButtonList($model, 'level', MyHelper::getLangAbility(), array('class' => 'validate[required] form-control iradio', 'separator' => ' &nbsp; &nbsp; &nbsp; &nbsp; '));
?>
						<?php 
echo CHtml::error($model, 'level');
?>
					</div>
				</div>
			</div>
			
			<div class="panel-footer">
				<?php 
/*echo CHtml::button('Clear Form', array('class'=>'btn btn-default'));*/
?>
				<?php 
echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'btn btn-primary pull-right'));
?>
示例#6
0
echo CHtml::encode($model->getAttributeLabel('name'));
?>
</label>
						<div class="col-md-6 col-xs-12"><?php 
echo CHtml::encode($model->name);
?>
</div>
					</div>
					
					<div class="form-group">
						<label class="col-md-3 col-xs-12 control-label"><?php 
echo CHtml::encode($model->getAttributeLabel('gender'));
?>
</label>
						<div class="col-md-6 col-xs-12"><?php 
echo MyHelper::viewGender($model->gender);
?>
</div>
					</div>
					
					<div class="form-group">
						<label class="col-md-3 col-xs-12 control-label"><?php 
echo CHtml::encode($model->getAttributeLabel('address_id'));
?>
</label>
						<div class="col-md-6 col-xs-12"><?php 
echo $model->viewAddress();
?>
</div>
					</div>
					
示例#7
0
</li>
					</ul>
				</div>

				<div class="panel-body form-group-separated">
					<div class="form-group">
						<label class="col-md-3 col-xs-12 control-label"><?php 
echo CHtml::encode($model->getAttributeLabel('language_id'));
?>
</label>
						<div class="col-md-6 col-xs-12"><?php 
echo CHtml::encode($model->language->name);
?>
</div>
					</div>

					<div class="form-group">
						<label class="col-md-3 col-xs-12 control-label"><?php 
echo CHtml::encode($model->getAttributeLabel('level'));
?>
</label>
						<div class="col-md-6 col-xs-12"><?php 
echo MyHelper::viewLangAbility($model->level);
?>
</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
 public function actionImport()
 {
     $model = new ImportForm();
     if (isset($_POST['ImportForm'])) {
         $model->attributes = $_POST['ImportForm'];
         MyHelper::ImportFile($model, AttendancePresences::model()->tableSchema->name, '`year`, `city_id`, `department_id`, `section_id`, `position_id`, `years_of_service_start`, `years_of_service_end`, `level_id`, `grade_id`, `basic_salary_from`, `basic_salary_to`, `basic_salary_inc_amount`, `basic_salary_inc_percentage`', array("attendance/schedulle"));
     }
     $this->render("importcsv", array('model' => $model));
 }
示例#9
0
 function __construct()
 {
     parent::__construct();
     App::import('Helper', 'community');
     $this->Community =& RegisterClass::getInstance('CommunityHelper');
 }
示例#10
0
</th><td><?php 
echo $recap->total_leave;
?>
</td></tr>
			<tr><th><?php 
echo at('Total Sick');
?>
</th><td><?php 
echo $recap->total_sick;
?>
</td></tr>
			<tr><th><?php 
echo at('Total Alpha');
?>
</th><td><?php 
echo MyHelper::getTotalWorkDay() - ($recap->total_in + $recap->total_leave + $recap->total_sick);
//$recap->total_alpha;
?>
</td></tr>
			<tr><th><?php 
echo at('Total Late');
?>
</th><td><?php 
echo $recap->total_late;
?>
</td></tr>
		</tbody>
		</table>
	</td>
	<td>
		<h2><?php 
示例#11
0
//echo '<h3>При вводе показаний повторно, предыдущие показания будут заменены вновь введенными.</h3>';
// Присвоение переменным серийных номеров счетчиков
for ($i = 1; $i <= $this->dataofsn->counts; $i++) {
    $csnp[$i] = $this->dataofsn->{'ser_num_p' . $i};
}
// Присвоение переменным названий точек установки
$name[1] = $this->dataofsn->electro_name_1;
$name[2] = $this->dataofsn->electro_name_2;
$name[3] = $this->dataofsn->electro_name_3;
//$form = $this->get('Check_electro');
// Получить текущую дату
$date = date("Y-m-d");
//$date_month = date("Y-m");
$day = date("d");
// Проверка на допущение ввода показаний по диапазону дат и повтора ввода показаний
$form = MyHelper::Check_electro($test, $date, $day);
if ($form > 0) {
    // Проверка на серийные номера. Если все серийные номера заполнены, то выводим форму
    if ($this->dataofsn->counts == 1 && $csnp[1] != NULL || $this->dataofsn->counts == 2 && $csnp[1] != NULL && $csnp[2] != NULL || $this->dataofsn->counts == 3 && $csnp[1] != NULL && $csnp[2] != NULL && $csnp[3] != NULL) {
        ?>
		<form class="form-validate" name="electros" id="electros"
			action="<?php 
        echo JRoute::_('index.php');
        ?>
" method="post">
			<fieldset>
				<!--<legend>Ввод показаний индивидуальных счетчиков газа</legend>-->

				<table BORDER=0 COLS=2>

				<?php 
示例#12
0
        <?php 
    foreach ($news->order_by('date_create', 'DESC')->find_all() as $n) {
        ?>
            <li>
                <div class="title"><?php 
        echo HTML::anchor('news/' . $n->id, $n->service->name);
        ?>
</div>
                <div class="date"><?php 
        echo MyDate::show($n->date_create);
        ?>
</div>
                <div class="text">
                    <?php 
        if ($n->image and file_exists($n->image)) {
            echo HTML::image(MyHelper::get_image_pict_name($n->image), array('align' => 'left', 'style' => 'margin-top: 4px; margin-right: 6px;'));
        }
        ?>
                    <?php 
        echo Text::limit_words(strip_tags($n->text), 70);
        ?>
                </div>
                <div class="more"><?php 
        echo HTML::anchor('news/' . $n->id, 'Подробнее');
        ?>
</div>
            </li>
        <?php 
    }
    ?>
    </ul>
 /**
  * Manages all models.
  */
 public function actionIndex()
 {
     $model = array();
     $year = date('Y');
     $month = date('j');
     if (isset($_POST['period_month'])) {
         $model = new AttendancePresencesRecap();
         $year = $_POST['period_year'];
         $month = $_POST['period_month'];
         $month = $month + 1;
         $period = MyHelper::getPayPeriode($month, $year);
         $month = $month - 1;
         // echo $period['from'].', '.$period['to'];
         $model->unsetAttributes();
         // clear any default values
         $model = $model->searchBy(Yii::app()->user->id, $period);
         $model->pagination = false;
     }
     if (isset($_GET['AttendancePresencesRecap'])) {
         $model->attributes = $_GET['AttendancePresencesRecap'];
     }
     $this->render('index', array('model' => $model, 'year_val' => $year, 'month' => $month));
 }
 public function actionGenerate()
 {
     $model = array();
     $year = date('Y');
     $month = date('j');
     if (isset($_POST['period_month'])) {
         $model = new AttendancePresencesRecap();
         $year = $_POST['period_year'];
         $month = $_POST['period_month'];
         $month = $month + 1;
         $period = MyHelper::getPayPeriode($month, $year);
         $month = $month - 1;
         // echo $period['from'].', '.$period['to'];
         $model->unsetAttributes();
         // clear any default values
         $model = $model->searchBy(Yii::app()->user->id, $period);
         $model->pagination = false;
     }
     if (isset($_GET['AttendancePresencesRecap'])) {
         $model->attributes = $_GET['AttendancePresencesRecap'];
     }
     $this->render('generate', array('model' => $model, 'year_val' => $year, 'month' => $month));
     // $model = new GenerateAttendanceForm;
     // if(isset($_POST['GenerateAttendanceForm']))
     // {
     // 	$model->attributes=$_POST['GenerateAttendanceForm'];
     // 	$model->moveDataToRecap();
     // } else {
     // 	$model->periode_type = 'current';
     // }
     // $currentPeriode = MyHelper::getCurrentPayPeriode();
     // if($model->periode_type == 'current')
     // {
     // 	if($model->start_date == '')
     // 		$model->start_date = $currentPeriode['from'];
     // 	if($model->end_date == '')
     // 		$model->end_date = $currentPeriode['to'];
     // }
     // $this->render("generate",array(
     // 	'model' 			=> $model,
     // 	'currentPeriode' 	=> $currentPeriode,
     // ));
 }
示例#15
0
//echo '<h3>При вводе показаний повторно, предыдущие показания будут заменены вновь введенными.</h3>';
// Присвоение переменным серийных номеров счетчиков
for ($i = 1; $i <= $this->dataofsn->counts; $i++) {
    $csnp[$i] = $this->dataofsn->{'ser_num_p' . $i};
}
// Присвоение переменным названий точек установки
$name[1] = $this->dataofsn->gaz_name_1;
$name[2] = $this->dataofsn->gaz_name_2;
$name[3] = $this->dataofsn->gaz_name_3;
//$form = $this->get('Check_Gaz');
// Получить текущую дату
$date = date("Y-m-d");
//$date_month = date("Y-m");
$day = date("d");
// Проверка на допущение ввода показаний по диапазону дат и повтора ввода показаний
$form = MyHelper::Check_Gaz($test, $date, $day);
if ($form > 0) {
    // Проверка на серийные номера. Если все серийные номера заполнены, то выводим форму
    if ($this->dataofsn->counts == 1 && $csnp[1] != NULL || $this->dataofsn->counts == 2 && $csnp[1] != NULL && $csnp[2] != NULL || $this->dataofsn->counts == 3 && $csnp[1] != NULL && $csnp[2] != NULL && $csnp[3] != NULL) {
        ?>
		<form class="form-validate" name="gazs" id="gazs"
			action="<?php 
        echo JRoute::_('index.php');
        ?>
" method="post">
			<fieldset>
				<!--<legend>Ввод показаний индивидуальных счетчиков газа</legend>-->

				<table BORDER=0 COLS=2>

				<?php 
示例#16
0
echo CHtml::link(CHtml::encode($language->employee->getFullname()), array('employees/view', 'id' => $language->employee_id));
?>
</div>
					</div>
					
					<div class="form-group">
						<label class="col-md-3 col-xs-12 control-label"><?php 
echo CHtml::encode($language->getAttributeLabel('language_id'));
?>
</label>
						<div class="col-md-6 col-xs-12"><?php 
echo CHtml::encode($language->language->name);
?>
</div>
					</div>

					<div class="form-group">
						<label class="col-md-3 col-xs-12 control-label"><?php 
echo CHtml::encode($language->getAttributeLabel('level'));
?>
</label>
						<div class="col-md-6 col-xs-12"><?php 
echo MyHelper::viewLangAbility($language->level);
?>
</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
示例#17
0
 public function actionGenerate()
 {
     $model = new GenerateAttendanceForm();
     if (isset($_POST['GenerateAttendanceForm'])) {
         $model->attributes = $_POST['GenerateAttendanceForm'];
         $model->generateEmployeeSalaries();
     } else {
         $model->periode_type = 'current';
     }
     $currentPeriode = MyHelper::getCurrentPayPeriode();
     if ($model->periode_type == 'current') {
         if ($model->start_date == '') {
             $model->start_date = $currentPeriode['from'];
         }
         if ($model->end_date == '') {
             $model->end_date = $currentPeriode['to'];
         }
     }
     $this->render("generate", array('model' => $model, 'currentPeriode' => $currentPeriode));
 }
示例#18
0
?>
					<div class="col-md-6 col-xs-12">
						<?php 
echo CHtml::activeDropDownList($language, 'language_id', CHtml::listData(ReferenceLanguages::model()->byOrder()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select'));
?>
						<div id="error_language_id" class="errorMessage"></div>
					</div>
				</div>

				<div class="form-group">
					<?php 
echo CHtml::activeLabelEx($language, 'level', array('class' => $label_class));
?>
					<div class="col-md-6 col-xs-12">                                                                                                                                           
						<?php 
echo CHtml::activeRadioButtonList($language, 'level', MyHelper::getLangAbility(), array('separator' => ' &nbsp; &nbsp; &nbsp; &nbsp; '));
?>
						<div id="error_level" class="errorMessage"></div>
					</div>
				</div>
			</div>
			
			<div class="panel-footer">
				<?php 
/*echo CHtml::button('Clear Form', array('class'=>'btn btn-default'));*/
?>
				
				<a href="#" class="btn btn-primary pull-right" id="btnSubmitLanguages"><?php 
echo $language->isNewRecord ? 'Create' : 'Save';
?>
</a>
示例#19
0
 public function addLink(Request $request)
 {
     $link = $request->all();
     $this->validate($request, ['link' => 'required|url']);
     try {
         $linkInform = file_get_html($link['link']);
         $data['link'] = $link['link'];
         $data['user_id'] = $link['id'];
         $data['title'] = $linkInform->find('title', 0)->innertext;
         $tags = $linkInform->find('meta[name="keywords"]', 0);
         $description = $linkInform->find('meta[name="description"]', 0);
         $image = $linkInform->find('meta[property="og:image"]', 0);
         $icon = $linkInform->find('link[rel*="shortcut"]', 0);
         if (!empty($image)) {
             $data['image'] = $image->content;
         }
         if (!empty($icon)) {
             $data['icon'] = $icon->href;
         } else {
             $icon = $linkInform->find('link[rel*="icon"]', 0);
             if (!empty($icon)) {
                 $data['icon'] = $icon->href;
             }
         }
         if (!empty($tags)) {
             $data['tags'] = str_limit($tags->content, $limit = 70, $end = '...');
         } elseif (!empty($description)) {
             $data['tags'] = $description->content;
         } else {
             $data['tags'] = '';
         }
         $data['url'] = Helper::url($link['link']);
         if ($link = Link::firstOrCreate($data)) {
             return response()->json(['status' => 'success', 'link' => $link]);
         } else {
             throw new Exception('Error');
         }
     } catch (Exception $e) {
         return response()->json(['status' => 'false', 'message' => $e->getMessage()]);
     }
 }
示例#20
0
</button>
								</span>
							</div>
							<?php 
echo CHtml::error($model, 'rm_id');
?>
						</div>
					</div>
					
					<div class="form-group">
						<?php 
echo CHtml::activeLabelEx($model, 'is_active', array('class' => $label_class));
?>
						<div class="col-md-9">
							<?php 
echo CHtml::activeDropDownList($model, 'is_active', MyHelper::getIsactive(), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select'));
?>
							<?php 
echo CHtml::error($model, 'is_active');
?>
						</div>
					</div>
				</div>
				
				<div class="col-md-6">
					<div class="form-group">
						<?php 
echo CHtml::activeLabelEx($model, 'street1', array('class' => $label_class));
?>
						<div class="col-md-9">
							<?php 
示例#21
0
 public function generateEmployeeId()
 {
     $hiredate = strtotime($this->hiredate);
     $code = date('ym', $hiredate);
     $c = new CDbCriteria();
     $c->condition = 'code like :code';
     $c->params = array(':code' => "{$code}%");
     $c->select = 'MAX(CONVERT(RIGHT(code,3),UNSIGNED INTEGER)) AS last_number';
     $model = MastersEmployees::model()->find($c);
     $last_number = count($model) > 0 ? $model->last_number + 1 : 1;
     return $code . MyHelper::numberString($last_number, 3, '0');
 }
示例#22
0
 function __construct()
 {
     parent::__construct();
 }
示例#23
0
for ($i = 1; $i <= $this->dataofsn->counts; $i++) {
    $csnp[$i] = $this->dataofsn->{'ser_num_cold_p' . $i};
    $hsnp[$i] = $this->dataofsn->{'ser_num_hot_p' . $i};
}
// Присвоение переменным названий точек установки
$name[1] = $this->dataofsn->water_name_1;
$name[2] = $this->dataofsn->water_name_2;
$name[3] = $this->dataofsn->water_name_3;
//$form = $this->get('Check');
// Получить текущую дату
$date = date("Y-m-d");
//$date_month = date("Y-m");
$day = date("d");
// Проверка на допущение ввода показаний по диапазону дат и повтора ввода показаний
$test = 0;
$form = MyHelper::check($test, $date, $day);
if ($form > 0) {
    // Проверка на серийные номера. Если все серийные номера заполнены, то выводим форму
    if ($this->dataofsn->counts == 1 && $csnp[1] != NULL && $hsnp[1] != NULL || $this->dataofsn->counts == 2 && $csnp[1] != NULL && $hsnp[1] != NULL && $csnp[2] != NULL && $hsnp[2] != NULL || $this->dataofsn->counts == 3 && $csnp[1] != NULL && $hsnp[1] != NULL && $csnp[2] != NULL && $hsnp[2] != NULL && $csnp[3] != NULL && $hsnp[3] != NULL) {
        ?>

		<form class="form-validate" name="waters" id="waters"
			action="<?php 
        echo JRoute::_('index.php');
        ?>
" method="post">
			<fieldset>
				<!--<legend>Ввод показаний индивидуальных счетчиков воды</legend>-->

				<table BORDER=0 COLS=2>