Do not use BaseUrl. Use [[Url]] instead.
Since: 2.0
Author: Alexander Makarov (sam@rmcreative.ru)
コード例 #1
0
ファイル: WsController.php プロジェクト: huylv-hust/ws
 /**
  * @inheritdoc
  */
 public function beforeAction()
 {
     $current_route = $this->getModules()[0]->requestedRoute;
     if (!Yii::$app->request->isAjax && !in_array($current_route, Yii::$app->params['route_keep_cookie'])) {
         utilities::deleteCookie('cus_info');
         //Delete coolkie cus_info
     }
     $session = \Yii::$app->session;
     if (!$session->get('login_info')) {
         $this->redirect(BaseUrl::base(true) . '/login');
         return false;
     }
     if ($login_info = $session->get('login_info') and $login_info['expired'] < time()) {
         $session->remove('login_info');
         unset($session['login_info']);
     }
     if (!$session->get('login_info')) {
         $this->redirect(BaseUrl::base(true) . '/timeout');
         return false;
     }
     if ($loginInfo = $session->get('login_info')) {
         $login_info['expired'] = time() + Yii::$app->params['timeOutLogin'];
         $session->set('login_info', $login_info);
     }
     return true;
 }
コード例 #2
0
ファイル: Url.php プロジェクト: bruno-melo/components
 public static function previous($name = null)
 {
     if ($name === null) {
         return self::getLastUrl();
     }
     return parent::previous($name);
 }
コード例 #3
0
ファイル: DataController.php プロジェクト: chaimvaid/linet3
 public function actionRestore($id = null)
 {
     $model = new FormBackupFile();
     $comp = $this->loadModel($this->company);
     if (isset($_POST['FormBackupFile'])) {
         $bkup = Company::getFilePath() . "tmp.zip";
         $model->file = $_POST['FormBackupFile']['file'];
         $model->file = \yii\web\UploadedFile::getInstance($model, 'file');
         if ($model->file->saveAs($bkup)) {
             $comp->restore($bkup);
             return $this->redirect(\yii\helpers\BaseUrl::base() . '/settings/dashboard');
         }
     }
     if ($id != null) {
         $file = Files::findOne($id);
         if ($file != null) {
             $comp->restore($file->getFullFilePath());
             $this->redirect(\yii\helpers\BaseUrl::base() . '/settings/dashboard');
         } else {
             throw new \yii\web\HttpException(500, 'The backup file does not exist.');
         }
     }
     //read file
     //if DROP TABLE IF EXISTS `
     //if CREATE TABLE `
     //INSERT INTO `
     return $this->render('backupRestore', array('model' => $model));
 }
コード例 #4
0
 public static function toRoute($route, $scheme = false)
 {
     $route[0] = ltrim($route[0], '/');
     if (substr_count($route[0], '/') == 2) {
         $route[0] = '/' . $route[0];
     }
     return "/" . I("__orgcode") . parent::toRoute($route, $scheme);
 }
コード例 #5
0
ファイル: accReport.php プロジェクト: chaimvaid/linet3
 public function init()
 {
     //$accHist = new AccHist('search');
     //$accHist->dt=today 00:00:00 > now > today 23:59:59
     $this->content = \app\widgets\GridView::widget(array('id' => 'acchist-grid', 'dataProvider' => $this->search(), 'layout' => '{items}{pager}', 'panel' => false, 'columns' => array(array('attribute' => 'account_id', 'value' => function ($data) {
         return \yii\helpers\Html::a(\yii\helpers\Html::encode(isset($data->account) ? $data->account->name : $data->account_id), \yii\helpers\BaseUrl::base() . ("/accounts/view/" . $data->account_id));
     }, 'format' => 'raw'), 'dt', array('attribute' => 'details', 'format' => 'raw', 'value' => function ($data) {
         return $data->brief();
     }))), true);
     //parent::init();
 }
コード例 #6
0
ファイル: docReport.php プロジェクト: chaimvaid/linet3
 public function init()
 {
     //$docs->=status=?? open??
     $this->content = \app\widgets\GridView::widget(array('id' => 'docs-grid', 'dataProvider' => $this->search(), 'layout' => '{items}{pager}', 'panel' => false, 'columns' => array(array('attribute' => 'doctype', 'value' => function ($data) {
         return \yii\helpers\html::a(\yii\helpers\html::encode((isset($data->docType) ? Yii::t("app", $data->docType->name) : "") . " #" . $data->docnum), \yii\helpers\BaseUrl::base() . ("/docs/view/" . $data->id));
     }, 'format' => 'raw'), array('attribute' => 'account_id', 'value' => function ($data) {
         return \yii\helpers\html::a(yii\helpers\html::encode($data->company), \yii\helpers\BaseUrl::base() . ("/accounts/transaction/" . $data->account_id));
     }, 'format' => 'raw'), 'total', array('attribute' => 'status', 'value' => function ($data) {
         return isset($data->docStatus) ? $data->docStatus->name : "";
     }))), true);
     //parent::init();
 }
コード例 #7
0
ファイル: salesReport.php プロジェクト: chaimvaid/linet3
 public function init()
 {
     //$docs = new Docs('search');
     $this->content = \app\widgets\GridView::widget(array('id' => 'sales-grid', 'dataProvider' => $this->search(), 'layout' => '{items}{pager}', 'panel' => false, 'columns' => array(array('attribute' => 'account_id', 'value' => function ($data) {
         return \yii\helpers\html::a(\yii\helpers\html::encode($data->company), \yii\helpers\BaseUrl::base() . ("/accounts/view/" . $data->account_id));
     }, 'format' => 'raw'), array('attribute' => 'docnum', 'value' => function ($data) {
         return \yii\helpers\html::a(\yii\helpers\html::encode($data->total), \yii\helpers\BaseUrl::base() . ("/docs/view/" . $data->id));
     }, 'format' => 'raw'), array('attribute' => 'due_date', 'value' => function ($data) {
         return $data->due_date;
     }))), true);
     //parent::init();
 }
コード例 #8
0
 protected function renderMenu()
 {
     $html = [];
     $html[] = '<div class="list-group">';
     foreach ($this->items as $item) {
         if (BaseUrl::current() == $item['url']) {
             $html[] = $this->renderActiveItem($item);
         } else {
             $html[] = $this->renderItem($item);
         }
     }
     $html[] = '</div>';
     return implode($html);
 }
コード例 #9
0
ファイル: ZipfileController.php プロジェクト: huylv-hust/ws
 /**
  * @inheritdoc
  */
 public function beforeAction()
 {
     $session = \Yii::$app->session;
     if (!$session->get('login_admin_info')) {
         Yii::$app->response->redirect(BaseUrl::base(true) . '/operator/login');
         return false;
     }
     if ($login_info = $session->get('login_admin_info') and $login_info['expired'] < time()) {
         $session->remove('login_admin_info');
         unset($session['login_admin_info']);
     }
     if ($loginInfo = $session->get('login_admin_info')) {
         $login_info['expired'] = time() + Yii::$app->params['timeOutLogin'];
         $session->set('login_admin_info', $login_info);
     }
     return true;
 }
コード例 #10
0
 public function actionSet($lang)
 {
     if (!Yii::$app->user->isGuest) {
         Yii::$app->user->identity->scenario = 'language';
         Yii::$app->user->identity->lang = $lang;
         Yii::$app->user->identity->save();
     }
     Yii::$app->session->set('lang', $lang);
     $redirectUrl = Yii::$app->request->get('redirect', false);
     if (!$redirectUrl) {
         $redirectUrl = Yii::$app->request->referrer;
     }
     if (!$redirectUrl) {
         $redirectUrl = \yii\helpers\BaseUrl::home(true);
     }
     return $this->redirect($redirectUrl);
 }
コード例 #11
0
ファイル: DefaultController.php プロジェクト: huylv-hust/ws
 /**
  * list order
  * @return string
  */
 public function actionIndex()
 {
     $all = new utilities();
     $branch = $all->getAllBranch();
     $data['all_ss'] = $branch['all_ss'];
     $obj = new Sdptd03denpyo();
     $obj_job = new Sdptm01sagyo();
     $filters = Yii::$app->request->get();
     $query_string = empty($filters) ? '' : '?' . http_build_query($filters);
     Yii::$app->session->set('url_list_workslip', BaseUrl::base() . '/list-workslip' . $query_string);
     if (empty($filters)) {
         $filters['start_time'] = date('Ymd');
         $filters['end_time'] = date('Ymd');
     }
     $data['filters'] = $filters;
     /*
      * Get login info
      * */
     $login_info = Yii::$app->session->get('login_info');
     if (isset($login_info['M50_SS_CD']) && $login_info['M50_SS_CD'] != '') {
         $data['filters']['m50_ss_cd'] = $login_info['M50_SS_CD'];
     }
     $count = $obj->countDataSearch($data['filters']);
     $data['pagination'] = new Pagination(['totalCount' => $count, 'defaultPageSize' => Yii::$app->params['defaultPageSize']]);
     $data['page'] = $filters = Yii::$app->request->get('page');
     $data['filters']['limit'] = $data['pagination']->limit;
     $data['filters']['offset'] = $data['pagination']->offset;
     $data['list'] = $obj->getDataSearch($data['filters']);
     if (empty($data['list'])) {
         Yii::$app->session->setFlash('empty', '入力条件に該当する作業伝票が存在しません');
     }
     $data['job'] = [];
     $all_job = $obj_job->getData();
     foreach ($all_job as $k => $v) {
         $data['job'][''] = '';
         $data['job'][$v['M01_SAGYO_NO']] = $v['M01_SAGYO_NAMEN'];
     }
     $data['status'] = Yii::$app->params['status'];
     Yii::$app->params['titlePage'] = '作業伝票一覧';
     Yii::$app->view->title = '情報検索';
     return $this->render('index', $data);
 }
コード例 #12
0
ファイル: MiniForm.php プロジェクト: chaimvaid/linet3
 /**
  * Display the widget
  * @see CWidget::run()
  */
 public function run()
 {
     //style="width:'.($this->width-$this->titlewidth-28).'px;"
     if ($this->content == '') {
         $this->content = ob_get_clean();
     }
     $helper = new \app\models\Help();
     $this->help = $helper->getHelp(str_replace(\yii\helpers\BaseUrl::base(), "", \Yii::$app->request->url));
     if ($this->help) {
         //' . \Yii::t("app", 'Help') . '
         $this->help = '<a class="btn btn-default" href="' . $this->help . '" target="_blank"><i class="glyphicon glyphicon-question-sign"></i></a>';
     } else {
         $this->help = '';
     }
     if ($this->collapse) {
         $this->collapse = '<a href="javascript:;" class="btn btn-default btn-xs collapse-box"  data-toggle="collapse">
                       <i class="fa fa-minus"></i>
                     </a> ';
         $this->collapse = '';
     } else {
         $this->collapse = '';
     }
     if ($this->height) {
         $this->height = 'style="height:' . $this->height . 'px"';
     } else {
         $this->height = '';
     }
     if ($this->fullscreen) {
         $this->fullscreen = '<a href="javascript:;" class="btn btn-default btn-xs full-box">
                       <i class="fa fa-expand"></i>
                     </a> ';
         $this->fullscreen = '';
     } else {
         $this->fullscreen = '';
     }
     //echo $this->getViewPath();
     //    exit;
     //CWidget::render();
     return $this->render("MiniForm", ["class" => $this->class, "logo" => $this->logo, "header" => $this->header, "help" => $this->help, "collapse" => $this->collapse, "fullscreen" => $this->fullscreen, "height" => $this->height, "content" => $this->content]);
     //$newform = '';
     //echo $newform;
 }
コード例 #13
0
ファイル: CommodityController.php プロジェクト: huylv-hust/ws
 /**
  * action import
  * @return \yii\web\Response
  */
 public function actionImport()
 {
     $request = Yii::$app->request;
     if ($request->isPost && isset($_FILES['commodity'])) {
         $obj = new Sdptm05com();
         if (substr($_FILES['commodity']['name'], -4) == '.csv') {
             $file = utilities::convertUtf8($_FILES['commodity']['tmp_name']);
             $result = $obj->saveImport($file);
             $error = $result['error'];
         } else {
             $error[] = 'CSVのフォーマットが正しくありません';
         }
         if (empty($error) && $result['insert']) {
             Yii::$app->session->setFlash('success', 'success');
         } else {
             Yii::$app->session->setFlash('error', $error);
         }
         return $this->redirect(BaseUrl::base(true) . '/update-commodity');
     }
 }
コード例 #14
0
ファイル: LitController.php プロジェクト: chaimvaid/linet3
 public function init()
 {
     date_default_timezone_set('Asia/Tel_Aviv');
     if (!\Yii::$app->user->isGuest) {
         \app\helpers\Linet3Helper::SetTheme();
         date_default_timezone_set(\Yii::$app->user->getParam('timezone'));
         \Yii::$app->language = Yii::$app->user->getParam('language');
     }
     if (Yii::$app->params['newInstall']) {
         if ($this->id != 'install') {
             //print "'".Yii::$app->controller->id."'";
             $this->redirect(\yii\helpers\BaseUrl::base() . '/install/index');
             Yii::$app->end();
         }
     } else {
         //include('upgrade.php');
     }
     //Yii::app()->clientScript->registerScriptFile($baseUrl.'/js/yourscript.js');
     return parent::init();
 }
コード例 #15
0
ファイル: PreviewController.php プロジェクト: huylv-hust/ws
 public function actionIndex()
 {
     $data['post'] = \Yii::$app->request->post();
     if (isset($data['post']['D01_SS_CD'])) {
         $branch = utilities::getAllBranch();
         $ss = $branch['all_ss'];
         $address = $branch['ss_address'];
         $tel = $branch['ss_tel'];
         $obj_job = new Sdptm01sagyo();
         $job[''] = '';
         $all_job = $obj_job->getData();
         foreach ($all_job as $k => $v) {
             $job[$v['M01_SAGYO_NO']] = $v['M01_SAGYO_NAMEN'];
         }
         $data['ss'] = isset($ss[$data['post']['D01_SS_CD']]) ? $ss[$data['post']['D01_SS_CD']] : '';
         $data['address'] = isset($address[$data['post']['D01_SS_CD']]) ? $address[$data['post']['D01_SS_CD']] : '';
         $data['tel'] = isset($tel[$data['post']['D01_SS_CD']]) ? $tel[$data['post']['D01_SS_CD']] : '';
         foreach ($data['post']['LIST_NAME'] as $k => $v) {
             $data['post']['M05_COM_NAMEN' . $k] = $v;
         }
         $data['job'] = $job;
         $data['status'] = \Yii::$app->params['status'];
         $tanto = explode('[]', $data['post']['D03_TANTO_MEI_D03_TANTO_SEI']);
         if (!empty($tanto[0]) && !empty($tanto[1])) {
             $data['post']['tanto'] = $tanto[0] . $tanto[1];
         }
         $kakunin = explode('[]', $data['post']['D03_KAKUNIN_MEI_D03_KAKUNIN_SEI']);
         if (!empty($kakunin[0]) && !empty($kakunin[1])) {
             $data['post']['kakunin'] = $kakunin[0] . $kakunin[1];
         }
         $data['post']['ss_user'] = $this->getssUser($data['post']['D01_SS_CD']);
         $data['ss_user'] = $data['post']['M08_NAME_MEI_M08_NAME_SEI'] ? $data['post']['ss_user'][$data['post']['M08_NAME_MEI_M08_NAME_SEI']] : '';
         $this->layout = '@app/views/layouts/print';
         \Yii::$app->view->title = '作業確認書';
         \Yii::$app->params['titlePage'] = '作業確認書';
         return $this->render('index', $data);
     }
     return $this->redirect(BaseUrl::base(true) . '/regist-workslip');
 }
コード例 #16
0
 public function actionLogin()
 {
     $model = new Users();
     // $username = "******";
     // $password = "******";
     $username = $_POST['username'];
     $password = $this->encrypt($_POST['password']);
     $detail_login = $model->find()->where(['FIELD3' => $username, 'FIELD4' => $password])->all();
     if ($detail_login) {
         $session = Yii::$app->session;
         foreach ($detail_login as $row) {
             $session->set('nama', $row['FIELD2']);
             $session->set('handphone', $row['FIELD6']);
             $session->set('email', $row['FIELD7']);
             $session->set('level', $row['FIELD8']);
             $session->set('company', $row['FIELD9']);
         }
         // $this->redirect(''.BaseUrl::base().'/dashboard/',302);
         echo BaseUrl::base() . "/dashboard";
     } else {
         echo "error";
     }
 }
コード例 #17
0
ファイル: Refnum.php プロジェクト: chaimvaid/linet3
 /**
  * Display the widget
  * @see CWidget::run()
  */
 public function run()
 {
     //style="width:'.($this->width-$this->titlewidth-28).'px;"
     $arr = explode('\\', get_class($this->model));
     $name = array_pop($arr);
     $id = $name . "_" . $this->attribute;
     $ids = $this->attribute . "_ids";
     //if (!($this->model->hasAttribute($this->attribute)))
     //if (!($this->model->{$this->attribute}))
     //throw new CHttpException(500, Yii::t('app', 'Did not set attr or model for refnum'));
     //Yii::$app->end();
     //$baseUrl = Yii::$app->request->baseUrl;
     $text = '';
     //if(function_exists(getRef())){
     //$this->model->getRef();
     if ($this->model->Docs !== null) {
         foreach ($this->model->Docs as $doc) {
             //echo \yii\helpers\Html::link($doc->docType->name . " #" . $doc->docnum, array('docs/view', "id" => $doc->id)) . "<br />";
             $text .= "<a href='" . \yii\helpers\BaseUrl::base() . "docs/view/{$doc->id}" . "' >" . $doc->docType->name . ' #' . $doc->docnum . "</a><br />";
         }
     }
     // }
     return $this->render("Refnum", ["name" => $name, "id" => $id, "ids" => $ids, "value" => $this->model->{$ids}, "text" => $text, "label" => $this->model->getAttributeLabel($this->attribute)]);
 }
コード例 #18
0
ファイル: index.php プロジェクト: kaihatsusha/kpimon
    switch ($model->entry_status) {
        case MasterValueUtils::MV_FIN_ENTRY_TYPE_SIMPLE:
            $urlEdit = BaseUrl::toRoute(['payment/update', 'id' => $entryId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
            $urlView = BaseUrl::toRoute(['payment/view', 'id' => $entryId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
            $urlCopy = BaseUrl::toRoute(['payment/copy', 'id' => $entryId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlCopy, $lblCopy]);
            break;
        case MasterValueUtils::MV_FIN_ENTRY_TYPE_DEPOSIT:
        case MasterValueUtils::MV_FIN_ENTRY_TYPE_INTEREST_DEPOSIT:
            $urlEdit = BaseUrl::toRoute(['deposit/update', 'id' => $timeDepositTranId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
            $urlView = BaseUrl::toRoute(['deposit/view', 'id' => $timeDepositTranId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
            $urlCopy = BaseUrl::toRoute(['deposit/copy', 'id' => $timeDepositTranId]);
            $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlCopy, $lblCopy]);
            break;
        default:
            break;
    }
    $html = '<div class="btn-group">';
    $html .= Html::a($lblEdit, [$urlEdit], ['class' => 'btn btn-' . $btnClass]);
    $html .= '<button type="button" class="btn btn-' . $btnClass . ' dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}]]]);
コード例 #19
0
ファイル: index_sp.php プロジェクト: kaihatsusha/kpimon
Pjax::begin();
echo GridView::widget(['layout' => '{summary}<div class="table-responsive">{items}</div>{pager}', 'options' => ['class' => 'grid-view col-xs-12'], 'tableOptions' => ['class' => 'table table-bordered'], 'showFooter' => true, 'pager' => ['options' => ['class' => 'pagination pagination-bottom'], 'maxButtonCount' => 6], 'dataProvider' => new ActiveDataProvider(['query' => $dataQuery, 'pagination' => ['pagesize' => 10]]), 'columns' => [['label' => Yii::t('fin.grid', 'Ref'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    $pagination = $column->grid->dataProvider->pagination;
    $html = $pagination->page * $pagination->pageSize + $index + 1;
    $html .= '<br/>' . str_pad($model->id, 6, '0', STR_PAD_LEFT);
    return $html;
}], ['label' => Yii::t('fin.grid', 'Status'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model) use($arrCustomerStatus) {
    $status = isset($arrCustomerStatus[$model->status]) ? $arrCustomerStatus[$model->status] : '';
    $html = '<span>' . $status . '</span>';
    $lblView = Yii::t('button', 'View');
    $lblEdit = Yii::t('button', 'Edit');
    $arrBtns = [];
    $entryId = $model->id;
    $urlEdit = BaseUrl::toRoute(['customer/update', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
    $urlView = BaseUrl::toRoute(['customer/view', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
    $html .= '<br/><div class="btn-group">';
    $html .= Html::a($lblEdit, [$urlEdit], ['class' => 'btn btn-xs btn-info']);
    $html .= '<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}], ['label' => Yii::t('fin.grid', 'Balance'), 'headerOptions' => ['style' => 'text-align: center'], 'footerOptions' => ['style' => 'vertical-align: middle; text-align: right'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: right'], 'format' => 'raw', 'value' => function ($model) {
    $labelClass = $model->balance < 0 ? 'label-danger' : 'label-info';
    $labelValue = NumberUtils::format(abs($model->balance));
    return StringUtils::format('{2}<br/><span class="label {0} pull-right">{1}</span>', [$labelClass, $labelValue, $model->name]);
}, 'footer' => NumberUtils::getIncDecNumber($sumCustomerValue['balance'], ['template' => '<span class="label pull-right {color}">{number}</span>', 'incColor' => 'label-info', 'decColor' => 'label-danger'])]]]);
コード例 #20
0
ファイル: Storage.php プロジェクト: Liv1020/cms
 /**
  *
  * Загрузить файл в хранилище, добавить в базу, вернуть модель StorageFile
  *
  * @param UploadedFile|string|File $file    объект UploadedFile или File или rootPath до файла локально или http:// путь к файлу (TODO:: доделать)
  * @param array $data                       данные для сохранения в базу
  * @param null $clusterId                   идентификатор кластера по умолчанию будет выбран первый из конфигурации
  * @return StorageFile
  * @throws Exception
  */
 public function upload($file, $data = [], $clusterId = null)
 {
     //Для начала всегда загружаем файл во временную диррикторию
     $tmpdir = Dir::runtimeTmp();
     $tmpfile = $tmpdir->newFile();
     if ($file instanceof UploadedFile) {
         $extension = File::object($file->name)->getExtension();
         $tmpfile->setExtension($extension);
         if (!$file->saveAs($tmpfile->getPath())) {
             throw new Exception("Файл не загружен во временную диррикторию");
         }
     } else {
         if ($file instanceof File || is_string($file) && BaseUrl::isRelative($file)) {
             $file = File::object($file);
             $tmpfile->setExtension($file->getExtension());
             $tmpfile = $file->move($tmpfile);
         } else {
             if (is_string($file) && !BaseUrl::isRelative($file)) {
                 $curl_session = curl_init($file);
                 if (!$curl_session) {
                     throw new Exception("Неверная ссылка");
                 }
                 curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, true);
                 curl_setopt($curl_session, CURLOPT_BINARYTRANSFER, true);
                 $file_content = curl_exec($curl_session);
                 curl_close($curl_session);
                 if (!$file_content) {
                     throw new Exception("Не удалось скачать файл");
                 }
                 $extension = pathinfo($file, PATHINFO_EXTENSION);
                 $pos = strpos($extension, "?");
                 if ($pos === false) {
                 } else {
                     $extension = substr($extension, 0, $pos);
                 }
                 if ($extension) {
                     $tmpfile->setExtension($extension);
                 }
                 $is_file_saved = file_put_contents($tmpfile, $file_content);
                 if (!$is_file_saved) {
                     throw new Exception("Не удалось сохранить файл");
                 }
                 //Если в ссылке нет расширения
                 if (!$extension) {
                     $tmpfile = new File($tmpfile->getPath());
                     try {
                         $mimeType = FileHelper::getMimeType($tmpfile->getPath(), null, false);
                     } catch (InvalidConfigException $e) {
                         throw new Exception("Не удалось пределить расширение файла: " . $e->getMessage());
                     }
                     if (!$mimeType) {
                         throw new Exception("Не удалось пределить расширение файла");
                     }
                     $extensions = FileHelper::getExtensionsByMimeType($mimeType);
                     if ($extensions) {
                         if (in_array("jpg", $extensions)) {
                             $extension = 'jpg';
                         } else {
                             if (in_array("png", $extensions)) {
                                 $extension = 'png';
                             } else {
                                 $extension = $extensions[0];
                             }
                         }
                         $newFile = new File($tmpfile->getPath());
                         $newFile->setExtension($extension);
                         $tmpfile = $tmpfile->copy($newFile);
                     }
                 }
             } else {
                 throw new Exception("Файл должен быть определен как \\yii\\web\\UploadedFile или \\skeeks\\sx\\File или string");
             }
         }
     }
     $data["type"] = $tmpfile->getType();
     $data["mime_type"] = $tmpfile->getMimeType();
     $data["size"] = $tmpfile->size()->getBytes();
     $data["extension"] = $tmpfile->getExtension();
     //Елси это изображение
     if ($tmpfile->getType() == 'image') {
         if (extension_loaded('gd')) {
             list($width, $height, $type, $attr) = getimagesize($tmpfile->toString());
             $data["image_height"] = $height;
             $data["image_width"] = $width;
         }
     }
     if ($cluster = $this->getCluster($clusterId)) {
         if ($newFileSrc = $cluster->upload($tmpfile)) {
             $data = array_merge($data, ["src" => $cluster->getPublicSrc($newFileSrc), "cluster_id" => $cluster->getId(), "cluster_file" => $newFileSrc]);
         }
     }
     $file = new StorageFile($data);
     $file->save(false);
     return $file;
 }
コード例 #21
0
ファイル: visualizar.php プロジェクト: brunofunny/agob
}
?>

            <div class="form-group">
                <label>Status</label>
                <p><span class="event <?php 
echo Yii::$app->AgobUtils->cssStatus($model->status, $model->d_ter);
?>
"></span><?php 
echo Yii::$app->params['status'][$model->status];
?>
</p>
            </div>

            <form action="<?php 
echo \yii\helpers\BaseUrl::current();
?>
" method="POST">
                <?php 
if (Yii::$app->user->can('Administrador')) {
    ?>
                    <div class="form-group">
                        <label>Observação</label>
                        <textarea name="Eventos[status_observacao]" class="form-control" rows="5"><?php 
    echo $model->status_observacao;
    ?>
</textarea>
                    </div>
                    <?php 
    if (Yii::$app->user->can('Administrador')) {
        ?>
コード例 #22
0
 public static function normalizeRoute($route)
 {
     return parent::normalizeRoute($route);
 }
コード例 #23
0
 /**
  * @param string $id The id of the widget
  * @param \yii\data\BaseDataProvider $dataProvider The dataprovider for the widget
  * @param \Closure $filter The filter to manipulate the data.
  * @return array The data required to create the list and pagination.
  */
 protected static function getData($id, $dataProvider, $filter)
 {
     $data = ['id' => $id];
     $data['count'] = $dataProvider->getCount();
     if (($pagination = $dataProvider->getPagination()) !== false) {
         $data['totalCount'] = $dataProvider->getTotalCount();
         $data['begin'] = $pagination->getPage() * $pagination->pageSize + 1;
         $data['end'] = $data['begin'] + $data['count'] - 1;
         if ($data['begin'] > $data['end']) {
             $data['begin'] = $data['end'];
         }
         $data['page'] = $pagination->getPage() + 1;
         $data['pageCount'] = $pagination->pageCount;
     } else {
         $data['totalCount'] = $dataProvider->getTotalCount();
         $data['pageCount'] = 1;
         $data['page'] = 1;
         $data['begin'] = $data['page'] = $data['pageCount'] = 1;
         $data['end'] = $data['totalCount'] = $data['count'];
     }
     $pagination = $dataProvider->getPagination();
     if ($pagination !== false) {
         $data['pageParam'] = $pagination->pageParam;
         $data['pageSizeParam'] = $pagination->pageSizeParam;
         $data['pageSizeLimit'] = $pagination->pageSizeLimit;
         $data['pageLinks'] = $pagination->getLinks();
         $currentPage = $pagination->getPage();
         $pageCount = $pagination->getPageCount();
         $maxButtonCount = 10;
         $beginPage = max(0, $currentPage - (int) ($maxButtonCount / 2));
         if (($endPage = $beginPage + $maxButtonCount - 1) >= $pageCount) {
             $endPage = $pageCount - 1;
             $beginPage = max(0, $endPage - $maxButtonCount + 1);
         }
         for ($i = $beginPage; $i <= $endPage; $i++) {
             $data['pages'][] = ['pageNo' => $i + 1, 'pageUrl' => $pagination->createUrl($i)];
         }
     }
     $sort = $dataProvider->getSort();
     if (!($sort === false || empty($sort->attributes) || $dataProvider->getCount() <= 0)) {
         $attributes = array_keys($sort->attributes);
         $data['sort'] = [];
         foreach ($attributes as $name) {
             $data['sort'][] = ['name' => $name, 'link' => $sort->createUrl($name)];
         }
     }
     $models = $dataProvider->getModels();
     if ($models) {
         $data['labels'] = $models[0]->attributeLabels();
     }
     $controller = Yii::$app->controller->id;
     foreach ($models as $key => $model) {
         $data['items'][$key] = $filter ? $filter($model) : $model->attributes;
         $data['items'][$key]['actions'] = ['viewUrl' => BaseUrl::toRoute(["{$controller}/view", 'id' => $model->primaryKey]), 'viewTitle' => Yii::t('app', 'View'), 'updateUrl' => BaseUrl::toRoute(["{$controller}/update", 'id' => $model->primaryKey]), 'updateTitle' => Yii::t('app', 'Update'), 'deleteUrl' => BaseUrl::toRoute(["{$controller}/delete", 'id' => $model->primaryKey]), 'deleteTitle' => Yii::t('app', 'Delete')];
     }
     return $data;
 }
コード例 #24
0
ファイル: header2.php プロジェクト: agungsuprayitno/sme
<?php 
    echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
    echo Alert::widget();
    ?>

<script type="text/javascript"> 
$(function() {
$("#dd_user_input").autocomplete({
source: "<?php 
    echo BaseUrl::base();
    ?>
/site/autokomplit",
minLength: 2,
select: function(event, ui) {
var getUrl = ui.item.id;
if(getUrl != '#') {
location.href = getUrl;
}
},
html: true, 
open: function(event, ui) {
$(".ui-autocomplete").css("z-index", 1000);
}
});
});
</script>
<?php 
} else {
    Yii::$app->response->redirect(BaseUrl::base());
}
コード例 #25
0
ファイル: AlertsController.php プロジェクト: AnduZhang/nws
 private function generatePDF($alertData)
 {
     $pdf = Yii::$app->pdf;
     // or new Pdf();
     $mpdf = $pdf->api;
     // fetches mpdf api
     $mpdf->SetHeader('NRESStormTracker Affected Properties for alertId = ' . $alertData->id);
     // call methods or set any properties
     $this->layout = 'print';
     $content = $this->render('//site/pdf', ['alert' => $alertData, 'affected' => $this->_affectedProperties]);
     $filename = date('Ymd_His') . '_' . $alertData->id . '.pdf';
     $mpdf->WriteHtml($content);
     echo $mpdf->Output(Yii::$app->basePath . '/web/' . $this->tmpPath . '/' . $filename, 'F');
     // call the mpdf api output as needed
     return BaseUrl::base(true) . '/' . $this->tmpPath . '/' . $filename;
 }
コード例 #26
0
ファイル: index.php プロジェクト: agungsuprayitno/sme
				      </h5>
				    </div>
			
			<table class="table table-bordered">
			<tr id="teltop"><th>NO</th><th>NAMA</th><th>EMAIL</th><th>PESAN</th><th>WAKTU</th><th>VIEW</th></tr>
			<?php 
if (isset($lengkap)) {
    $no = 1;
    foreach ($lengkap as $ar) {
        $waktu = substr($ar['TIME'], 0, 10);
        $pesan = substr($ar['PESAN'], 0, 100);
        if (isset($ar['DIVRE']) and $ar['DIVRE'] != "") {
            $divre = $ar['DIVRE'];
        } else {
            $divre = "ALL";
        }
        echo "<tr><td>" . $no . "</td><td>" . $ar['NAMA'] . "</td><td>" . $ar['EMAIL'] . "</td><td>" . $pesan . "</td><td>" . $waktu . "</td>\n\t\t\t<td><a class='detail' href='#' tabelid='" . $ar['ID'] . "'><img src='" . BaseUrl::base() . "/assets/img/edit_find.png' title='Detail' /></a> </td></tr>";
        $no++;
    }
}
?>
			</table>
			
	<div id="form_detail">
       <div id="ketok"></div>
	</div>
			
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
			
コード例 #27
0
ファイル: index_sp.php プロジェクト: kaihatsusha/kpimon
Pjax::begin();
echo GridView::widget(['layout' => '{summary}<div class="table-responsive">{items}</div>{pager}', 'options' => ['class' => 'grid-view col-xs-12'], 'tableOptions' => ['class' => 'table table-bordered'], 'pager' => ['options' => ['class' => 'pagination pagination-bottom'], 'maxButtonCount' => 6], 'dataProvider' => new ActiveDataProvider(['query' => $dataQuery, 'pagination' => ['pagesize' => 20]]), 'columns' => [['label' => Yii::t('fin.grid', 'Ref'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    $pagination = $column->grid->dataProvider->pagination;
    $html = $pagination->page * $pagination->pageSize + $index + 1;
    $html .= '<br/>' . str_pad($model->nav_id, 6, '0', STR_PAD_LEFT);
    return $html;
}], ['label' => Yii::t('fin.grid', 'Trade'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: center'], 'format' => 'raw', 'value' => function ($model) {
    $html = DateTimeUtils::htmlDateFormatFromDB($model->trade_date, DateTimeUtils::FM_VIEW_DATE, true);
    $lblView = Yii::t('button', 'View');
    $lblEdit = Yii::t('button', 'Edit');
    $urlEdit = null;
    $arrBtns = [];
    $entryId = $model->nav_id;
    $urlEdit = BaseUrl::toRoute(['nav/update', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
    $urlView = BaseUrl::toRoute(['nav/view', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
    $html .= '<br/><div class="btn-group">';
    $html .= Html::a($lblEdit, [$urlEdit], ['class' => 'btn btn-xs btn-info']);
    $html .= '<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}], ['label' => Yii::t('fin.grid', 'Nav / Prev'), 'headerOptions' => ['style' => 'text-align: center'], 'contentOptions' => ['style' => 'vertical-align: middle; text-align: left;'], 'format' => 'raw', 'value' => function ($model) {
    $htmls = [];
    $navPrev = NumberUtils::format($model->nav_value_prev, 2);
    $htmls[] = '<span class="label label-info pull-right">' . $navPrev . '</span>';
    $nav = NumberUtils::format($model->nav_value, 2);
コード例 #28
0
ファイル: index.php プロジェクト: huylv-hust/ws
<main id="contents">
    <section class="readme">
        <p>宇佐美SSをご利用いただき、ありがとうございます。</p>
    </section>
    <article class="container">
        <p class="centering">項目を選択してください。</p>
        <nav class="navBasic">
            <ul class="ulNavBasic">
                <li><a href="#" class="btnNavBasic iconCard" onclick="fncCard();">Usappy<br />カード番号変更</a></li>
                <li><a href="#" class="btnNavBasic iconRegistWork" onclick="fncType('regist');">作業伝票作成</a></li>
                <li><a href="<?php 
echo \yii\helpers\BaseUrl::base(true);
?>
/list-workslip" class="btnNavBasic iconSearchWork">情報検索</a></li>
                <li><a href="maintenance" class="btnNavBasic iconMainte">メンテナンス</a></li>
                <?php 
$login_info = Yii::$app->session->get('login_info');
?>
                <li><a href="/asbo/?sscode=<?php 
echo $login_info['M50_SS_CD'];
?>
" class="btnNavOther iconReserve">作業予約管理へ</a></li>
                <?php 
if (in_array($login_info['M50_SS_CD'], Yii::$app->params['sateiss'])) {
    ?>
                <li><a href="/satei/?sscode=<?php 
    echo $login_info['M50_SS_CD'];
    ?>
" class="btnNavOther iconOldCar">中古車査定サイトへ</a></li>
                <?php 
}
コード例 #29
0
ファイル: usermanag.php プロジェクト: agungsuprayitno/sme
</td>
			<td><a href="#" id="edituser" <?php 
        echo "iduser='******'ID'] . "' nama='" . $ar['NAMA'] . "' email='" . $ar['EMAIL'] . "' kompani='" . $ar['COMPANY'] . "' nik='" . $ar['NIK'] . "' ";
        ?>
>
				<img src="<?php 
        echo BaseUrl::base();
        ?>
/assets/img/update.png" title="Update" /></a> 
				<a href="<?php 
        echo BaseUrl::base();
        ?>
/site/deleteuser?id=<?php 
        echo $ar["ID"];
        ?>
"><img src="<?php 
        echo BaseUrl::base();
        ?>
/assets/img/delete.png" title="Delete" /></a></td></tr>
			<?php 
        $no++;
    }
}
?>
			</table><br><br><br>
			

                </section><!-- /.content -->
            </aside><!-- /.right-side -->
			
コード例 #30
0
ファイル: index.php プロジェクト: kaihatsusha/kpimon
}, 'value' => function ($model) use($arrCurrentAssets) {
    return isset($arrCurrentAssets[$model->current_assets]) ? $arrCurrentAssets[$model->current_assets] : '';
}, 'footer' => $htmlFooterAdding], ['label' => Yii::t('fin.grid', 'Action'), 'headerOptions' => ['style' => 'text-align: center; width: 100px;'], 'contentOptions' => function ($model, $key, $index) {
    return ['style' => 'vertical-align: middle; text-align: center', 'class' => MasterValueUtils::getColorRow($index)];
}, 'format' => 'raw', 'value' => function ($model, $key, $index) {
    $btnClass = MasterValueUtils::getColorRow($index);
    $lblView = Yii::t('button', 'View');
    $lblEdit = Yii::t('button', 'Edit');
    $lblCopy = Yii::t('button', 'Copy');
    $arrBtns = [];
    $entryId = $model->transactions_id;
    $urlEdit = BaseUrl::toRoute(['deposit/update', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlEdit, $lblEdit]);
    $urlView = BaseUrl::toRoute(['deposit/view', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlView, $lblView]);
    $urlCopy = BaseUrl::toRoute(['deposit/copy', 'id' => $entryId]);
    $arrBtns[] = StringUtils::format('<li><a href="{0}">{1}</a></li>', [$urlCopy, $lblCopy]);
    $html = '<div class="btn-group">';
    $html .= Html::a($lblEdit, [$urlEdit], ['class' => 'btn btn-' . $btnClass]);
    $html .= '<button type="button" class="btn btn-' . $btnClass . ' dropdown-toggle" data-toggle="dropdown">';
    $html .= '<span class="caret"></span><span class="sr-only">Toggle Dropdown</span>';
    $html .= '</button>';
    $html .= '<ul class="dropdown-menu" role="menu">';
    $html .= implode('', $arrBtns);
    $html .= '</ul></div>';
    return $html;
}]]]);
Pjax::end();
?>
</div>
	<?php