get() public static method

Get the translation for the given key.
public static get ( string $key, array $replace = [], string | null $locale = null, boolean $fallback = true ) : string | array | null
$key string
$replace array
$locale string | null
$fallback boolean
return string | array | null
示例#1
2
 public function import($entity)
 {
     $appHelper = new libs\AppHelper();
     $className = $appHelper->getNameSpace() . $entity;
     $model = new $className();
     $table = $model->getTable();
     $columns = \Schema::getColumnListing($table);
     $key = $model->getKeyName();
     $notNullColumnNames = array();
     $notNullColumnsList = \DB::select(\DB::raw("SHOW COLUMNS FROM `" . $table . "` where `Null` = 'no'"));
     if (!empty($notNullColumnsList)) {
         foreach ($notNullColumnsList as $notNullColumn) {
             $notNullColumnNames[] = $notNullColumn->Field;
         }
     }
     $status = \Input::get('status');
     $filePath = null;
     if (\Input::hasFile('import_file') && \Input::file('import_file')->isValid()) {
         $filePath = \Input::file('import_file')->getRealPath();
     }
     if ($filePath) {
         \Excel::load($filePath, function ($reader) use($model, $columns, $key, $status, $notNullColumnNames) {
             $this->importDataToDB($reader, $model, $columns, $key, $status, $notNullColumnNames);
         });
     }
     $importMessage = $this->failed == true ? \Lang::get('panel::fields.importDataFailure') : \Lang::get('panel::fields.importDataSuccess');
     return \Redirect::to('panel/' . $entity . '/all')->with('import_message', $importMessage);
 }
示例#2
0
 public function action_index()
 {
     if (!\DBUtil::table_exists('blog') && !\DBUtil::table_exists('blog_comment')) {
         \Response::redirect('blog/installrequired');
     }
     // list posts -----------------------------------------------------------------------------------------------------
     $option['limit'] = \Model_Config::getval('content_items_perpage');
     $option['offset'] = trim(\Input::get('page')) != null ? ((int) \Input::get('page') - 1) * $option['limit'] : 0;
     $list_items = \Blog\Model_Blog::listItems($option);
     // pagination config
     $config['pagination_url'] = \Uri::main() . \Uri::getCurrentQuerystrings(true, true, false);
     $config['total_items'] = $list_items['total'];
     $config['per_page'] = $option['limit'];
     $config['uri_segment'] = 'page';
     $config['num_links'] = 3;
     $config['show_first'] = true;
     $config['show_last'] = true;
     $config['first-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
     $config['first-inactive-link'] = '<a href="#">{page}</a>';
     $config['first-marker'] = '&laquo;';
     $config['last-inactive'] = "\n\t\t<li class=\"disabled\">{link}</li>";
     $config['last-inactive-link'] = '<a href="#">{page}</a>';
     $config['last-marker'] = '&raquo;';
     $config['previous-marker'] = '&lsaquo;';
     $config['next-marker'] = '&rsaquo;';
     $pagination = \Pagination::forge('viewlogins_pagination', $config);
     $output['list_items'] = $list_items;
     $output['pagination'] = $pagination;
     unset($config, $list_accounts, $option, $pagination);
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('blog'));
     // <head> output ----------------------------------------------------------------------------------------------
     return $this->generatePage('blog_v', $output, false);
 }
    public function getData()
    {
        //return 'kfjhje';
        return Datatable::collection(Category::All())->searchColumns('name')->orderColumns('name', 'description')->addColumn('name', function ($model) {
            return $model->name;
        })->addColumn('Created', function ($model) {
            $t = $model->created_at;
            return TicketController::usertimezone($t);
        })->addColumn('Actions', function ($model) {
            //return '<a href=category/delete/' . $model->id . ' class="btn btn-danger btn-flat">Delete</a>&nbsp;<a href=category/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=article-list class="btn btn-warning btn-flat">View</a>';
            return '<span  data-toggle="modal" data-target="#deletecategory' . $model->slug . '"><a href="#" ><button class="btn btn-danger btn-xs"></a>' . \Lang::get("lang.delete") . '</button></span>&nbsp;<a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get("lang.edit") . '</a>&nbsp;<a href=article-list class="btn btn-primary btn-xs">' . \Lang::get("lang.view") . '</a>
				<div class="modal fade" id="deletecategory' . $model->slug . '">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">Are You Sure ?</h4>
                </div>
                <div class="modal-body">
                	' . $model->name . '
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
                    <a href="category/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>';
        })->make();
    }
示例#4
0
 public static function lang($string)
 {
     if (static::isLaravel()) {
         return \Lang::get($string);
     }
     return $string;
 }
示例#5
0
 public static function agregar($input)
 {
     $respuesta = array();
     //Se definen las reglas con las que se van a validar los datos..
     $reglas = array('email' => array('required'));
     //Se realiza la validación
     $validator = Validator::make($input, $reglas);
     if ($validator->fails()) {
         $respuesta['mensaje'] = Lang::get('models.cliente.email_invalido');
         //Si está todo mal, carga lo que corresponde en el mensaje.
         $respuesta['error'] = true;
     } else {
         //Se cargan los datos necesarios para la creacion del Item
         $datos = array('email' => $input['email'], 'fecha_carga' => date("Y-m-d H:i:s"));
         if (isset($input['nombre_apellido'])) {
             $datos['nombre_apellido'] = $input['nombre_apellido'];
         }
         if (isset($input['telefono'])) {
             $datos['telefono'] = $input['telefono'];
         }
         if (isset($input['consulta'])) {
             $datos['consulta'] = $input['consulta'];
         }
         //Lo crea definitivamente
         $cliente = static::create($datos);
         //Mensaje correspondiente a la agregacion exitosa
         $respuesta['mensaje'] = Lang::get('models.cliente.creado');
         $respuesta['error'] = false;
         $respuesta['data'] = $cliente;
     }
     return $respuesta;
 }
示例#6
0
 function index()
 {
     $page = $this->_get_page(8);
     $type = isset($_GET['type']) && $_GET['type'] != '' ? trim($_GET['type']) : 'all_qa';
     $conditions = '1=1 AND goods_qa.user_id = ' . $_SESSION['user_info']['user_id'];
     if ($type == 'reply_qa') {
         $conditions .= ' AND reply_content !="" ';
     }
     $my_qa_data = $this->my_qa_mod->find(array('fields' => 'ques_id,question_content,reply_content,time_post,time_reply,goods_qa.user_id,goods_qa.item_name,goods_qa.item_id,goods_qa.email,goods_qa.type,if_new,user_name', 'join' => 'belongs_to_store,belongs_to_user', 'count' => true, 'conditions' => $conditions, 'limit' => $page['limit'], 'order' => 'if_new desc,time_post desc'));
     /* 当前位置 */
     $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_question'), 'index.php?app=my_question', LANG::get('my_question_list'));
     /* 当前用户中心菜单 */
     $this->_curitem('my_question');
     /* 当前所处子菜单 */
     $this->_curmenu('my_qa_list');
     $page['item_count'] = $this->my_qa_mod->getCount();
     //获取统计的数据
     $this->_format_page($page);
     $this->assign('_curmenu', $type);
     $this->assign('page_info', $page);
     $this->assign('my_qa_data', $my_qa_data);
     if ($type == 'reply_qa') {
         $update_data = array('if_new' => '0');
         $this->my_qa_mod->edit($my_qa_data['ques_id'], $update_data);
     }
     $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_question'));
     $this->display('my_question.index.html');
 }
 function get_type_logist($logist, $city_id, $types)
 {
     $logist_fee = array();
     // 通过运送目的地city_id(城市id),获取该城市的上级id,即省id,如果 $city_id=0(等于0是在通过淘宝IP数据库无法返回正常的城市名称的前提下出现,当出现该情况时,取默认运费,即设置:province_id=1
     if ($city_id) {
         $region_mod =& m('region');
         $region = $region_mod->get(array('conditions' => 'region_id=' . $city_id, 'fields' => 'parent_id'));
         $porovince_id = $region['parent_id'];
     } else {
         $porovince_id = 1;
     }
     foreach ($types as $type) {
         $find = false;
         if (isset($logist['area_fee'][$type])) {
             if (isset($logist['area_fee'][$type]['other_fee'])) {
                 foreach ($logist['area_fee'][$type]['other_fee'] as $key => $val) {
                     $dest_ids = explode('|', $val['dest_ids']);
                     if (in_array($city_id, $dest_ids) || in_array($porovince_id, $dest_ids)) {
                         $logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $val['start_standards'], 'start_fees' => $val['start_fees'], 'add_standards' => $val['add_standards'], 'add_fees' => $val['add_fees']);
                         $find = true;
                         break;
                     }
                 }
                 if (!$find) {
                     $logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $logist['area_fee'][$type]['default_fee']['start_standards'], 'start_fees' => $logist['area_fee'][$type]['default_fee']['start_fees'], 'add_standards' => $logist['area_fee'][$type]['default_fee']['add_standards'], 'add_fees' => $logist['area_fee'][$type]['default_fee']['add_fees']);
                 }
             } else {
                 $logist_fee[] = array('type' => $type, 'name' => Lang::get($type), 'start_standards' => $logist['area_fee'][$type]['default_fee']['start_standards'], 'start_fees' => $logist['area_fee'][$type]['default_fee']['start_fees'], 'add_standards' => $logist['area_fee'][$type]['default_fee']['add_standards'], 'add_fees' => $logist['area_fee'][$type]['default_fee']['add_fees']);
             }
         }
     }
     return $logist_fee;
 }
示例#8
0
 /**
  * Run CasperJS tests.
  * @return bool
  */
 public function execute()
 {
     $this->phpci->logExecOutput(false);
     $casperJs = $this->phpci->findBinary('casperjs');
     if (!$casperJs) {
         $this->phpci->logFailure(Lang::get('could_not_find', 'casperjs'));
         return false;
     }
     $curdir = getcwd();
     chdir($this->phpci->buildPath);
     $cmd = $casperJs . " test {$this->tests_path} --xunit={$this->x_unit_file_path} {$this->arguments}";
     $success = $this->phpci->executeCommand($cmd);
     chdir($curdir);
     $xUnitString = file_get_contents($this->x_unit_file_path);
     try {
         $xUnitParser = new XUnitParser($xUnitString);
         $output = $xUnitParser->parse();
         $failures = $xUnitParser->getTotalFailures();
     } catch (\Exception $ex) {
         $this->phpci->logFailure($xUnitParser);
         throw $ex;
     }
     $this->build->storeMeta('casperJs-errors', $failures);
     $this->build->storeMeta('casperJs-data', $output);
     $this->phpci->logExecOutput(true);
     return $success;
 }
示例#9
0
 public function update($id)
 {
     if (Auth::id() != $id) {
         return Redirect::to('http://google.com');
     }
     $user = Auth::User();
     $validator = Validator::make(Input::all(false), ['email' => 'required|email|unique:users,email,' . $id, 'password' => 'min:5|confirmed:password_confirmation', 'first_name' => 'required', 'last_name' => 'required']);
     if ($validator->passes()) {
         $img_ava = $user->avatar_img;
         $password = Input::get('password');
         if (Input::hasFile('avatar_img')) {
             if (File::exists(Config::get('user.upload_user_ava_directory') . $img_ava)) {
                 File::delete(Config::get('user.upload_user_ava_directory') . $img_ava);
             }
             if (!is_dir(Config::get('user.upload_user_ava_directory'))) {
                 File::makeDirectory(Config::get('user.upload_user_ava_directory'), 0755, true);
             }
             $img = Image::make(Input::file('avatar_img'));
             $img_ava = md5(Input::get('username')) . '.' . Input::file('avatar_img')->getClientOriginalExtension();
             if ($img->width() < $img->height()) {
                 $img->resize(100, null, function ($constraint) {
                     $constraint->aspectRatio();
                 })->crop(100, 100)->save(Config::get('user.upload_user_ava_directory') . $img_ava, 90);
             } else {
                 $img->resize(null, 100, function ($constraint) {
                     $constraint->aspectRatio();
                 })->crop(100, 100)->save(Config::get('user.upload_user_ava_directory') . $img_ava, 90);
             }
         }
         $user->update(['username' => null, 'email' => Input::get('email'), 'password' => !empty($password) ? Hash::make($password) : $user->password, 'first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name')]);
         return Redirect::back()->with('success_msg', Lang::get('messages.successupdate'));
     } else {
         return Redirect::back()->withErrors($validator)->withInput();
     }
 }
示例#10
0
 public function actionBuy()
 {
     if (!Auth::isLogged()) {
         $this->redirect("/");
     }
     $abonems = AbonemModel::model()->findAll();
     if (isset($_POST['abonem'])) {
         $abonem = AbonemModel::model()->where("`id`=" . (int) $_POST['abonem'])->findRow();
         $userAbon = UserAbonemModel::model()->where("`user_id`='" . Auth::getUser()['id'] . "'")->findRow();
         if (!$userAbon) {
             $userAbon = new UserAbonemModel();
             $userAbon->user_id = Auth::getUser()['id'];
             $userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime('today')));
             $userAbon->insert();
         } else {
             if (strtotime($userAbon->end_date) > strtotime('today')) {
                 $userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime($userAbon->end_date)));
             } else {
                 $userAbon->end_date = date('Y-m-d', strtotime('+' . $abonem->months . ' month', strtotime('today')));
             }
             $userAbon->update();
         }
         Abonement::setAbonement();
         $this->view("success", array("message" => Lang::get("abonement_success")), false);
     }
     $this->view("abonem/buy", array("abonems" => $abonems), false);
 }
示例#11
0
文件: StringUtil.php 项目: cebe/chive
 /**
  * Cuts the given text to a specific lenght and adds ... at the and
  *
  * @param string $_text
  * @param int $_lenght
  * @param bool $_isFoldable 		(for unfolding / folding longer texts)
  * @return string
  */
 public static function cutText($_text, $_length, $_isFoldable = false)
 {
     $_text = strip_tags($_text);
     if (function_exists("mb_strlen")) {
         $length = mb_strlen($_text, "utf-8");
     } else {
         $length = strlen($_text);
     }
     if ($length > $_length) {
         $cutLength = max(1, $_length - 3);
         if (function_exists("mb_substr")) {
             $text = mb_substr($_text, 0, $cutLength, "utf-8");
             $textRest = mb_substr($_text, $cutLength, mb_strlen($_text, "utf-8"), "utf-8");
         } else {
             $text = substr($_text, 0, $cutLength);
             $textRest = substr($_text, $cutLength);
         }
         if (!$_isFoldable) {
             $text .= "...";
         } else {
             $id = "more_" . StringUtil::getRandom(5);
             $text .= " " . "<a style=\"text-decoration: none; font-size: 0.8em;\" id=\"show_" . $id . "\" href=" . CURRENT_PAGE_QS . "/# onclick=\"getById('" . $id . "').style.display = 'inline'; showHide('show_" . $id . "'); showHide('hide_" . $id . "'); return false;\">(" . Lang::get("global.w.more") . ")</a>" . "<b style=\"margin: 0px; font-weight: normal; display: none;\" id=\"" . $id . "\">" . $textRest . "</b>" . "<a style=\"text-decoration: none; font-size: 0.8em; float: left; display: none;\" id=\"hide_" . $id . "\" href=" . CURRENT_PAGE_QS . "/# onclick=\"getById('" . $id . "').style.display = 'none'; showHide('hide_" . $id . "'); showHide('show_" . $id . "'); return false;\">(" . Lang::get("global.w.less") . ")</a>";
         }
         return $text;
     } else {
         return $_text;
     }
 }
 /**
  * Constructor.
  *
  * @param string     $message  The internal exception message
  * @param \Exception $previous The previous exception
  * @param int        $code     The internal exception code
  */
 public function __construct($message = null, \Exception $previous = null, $code = 0)
 {
     if (!$message) {
         $message = \Lang::get('api-proxy-laravel::messages.proxy_cookie_invalid');
     }
     parent::__construct(500, $message, $previous, array(), $code);
 }
示例#13
0
 public function action_index()
 {
     // clear redirect referrer
     \Session::delete('submitted_redirect');
     // read flash message for display errors.
     $form_status = \Session::get_flash('form_status');
     if (isset($form_status['form_status']) && isset($form_status['form_status_message'])) {
         $output['form_status'] = $form_status['form_status'];
         $output['form_status_message'] = $form_status['form_status_message'];
     }
     unset($form_status);
     // list tables
     $output['list_tables'] = \DB::list_tables();
     // if form submitted
     if (\Input::method() == 'POST') {
         $table_name = trim(\Input::post('table_name'));
         $output['table_name'] = $table_name;
         if (!\Extension\NoCsrf::check()) {
             // validate token failed
             $output['form_status'] = 'error';
             $output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token');
         } elseif ($table_name == null) {
             $output['form_status'] = 'error';
             $output['form_status_message'] = \Lang::get('dbhelper_please_select_db_table');
         } else {
             $output['list_columns'] = \DB::list_columns(\DB::expr('`' . $table_name . '`'));
         }
     }
     // endif; form submitted
     // <head> output ---------------------------------------------------------------------
     $output['page_title'] = $this->generateTitle(\Lang::get('dbhelper'));
     // <head> output ---------------------------------------------------------------------
     return $this->generatePage('admin/templates/index/index_v', $output, false);
 }
示例#14
0
 public function action_index()
 {
     if (\Input::method() == 'POST') {
         if (!\Extension\NoCsrf::check()) {
             // validate token failed
             $output['form_status'] = 'error';
             $output['form_status_message'] = \Lang::get('fslang_invalid_csrf_token');
         } else {
             // update to 1.5 first time
             $result = \Fs\update0001::run();
             // update to 1.5.4
             $result = \Fs\update0002::run();
             if ($result === true) {
                 $output['hide_form'] = true;
                 $output['form_status'] = 'success';
                 $output['form_status_message'] = \Lang::get('fs_update_completed');
             } else {
                 $output['form_status'] = 'error';
                 $output['form_status_message'] = \Lang::get('fs_failed_to_update');
             }
         }
     }
     // <head> output ----------------------------------------------------------------------------------------------
     $output['page_title'] = \Lang::get('fs_updater');
     // <head> output ----------------------------------------------------------------------------------------------
     $theme = \Theme::instance();
     return $theme->view('update_v', $output, false);
 }
 /**
  * @param Message $message
  * @return mixed
  */
 public function handle(Message $message)
 {
     if ($message->user->login === \Auth::user()->login) {
         return $message;
     }
     // Personal message
     $isBotMention = $message->hasMention(function (User $user) {
         return $user->login === \Auth::user()->login;
     });
     if ($isBotMention) {
         //$this->ai->handle($message);
     } else {
         // Hello all
         $isHello = Str::contains($message->text_without_special_chars, \Lang::get('personal.hello_query'));
         if ($isHello) {
             $id = array_rand(\Lang::get('personal.hello'));
             $message->italic(\Lang::get('personal.hello.' . $id, ['user' => $message->user->login]));
         }
         // Question
         $isQuestion = Str::contains($message->text_without_special_chars, ['можно задать вопрос', 'хочу задать вопрос']);
         if ($isQuestion) {
             $message->italic(sprintf('@%s, и какой ответ ты ожидаешь услышать?', $message->user->login));
         }
     }
     return $message;
 }
示例#16
0
 function index()
 {
     /* 取得列表数据 */
     $conditions = $this->_get_query_conditions(array(array('field' => 'state', 'name' => 'state', 'handler' => 'groupbuy_state_translator'), array('field' => 'group_name', 'name' => 'group_name', 'equal' => 'LIKE')));
     // 标识有没有过滤条件
     if ($conditions) {
         $this->assign('filtered', 1);
     }
     $page = $this->_get_page(10);
     //获取分页信息
     $groupbuy_list = $this->_groupbuy_mod->find(array('join' => 'be_join', 'order' => 'gb.group_id DESC', 'limit' => $page['limit'], 'count' => true, 'conditions' => 'user_id=' . $this->visitor->info['user_id'] . $conditions));
     $page['item_count'] = $this->_groupbuy_mod->getCount();
     //获取统计的数据
     foreach ($groupbuy_list as $key => $groupbuy) {
         $groupbuy['ican'] = $this->_ican($groupbuy['group_id']);
         $groupbuy_list[$key] = $groupbuy;
         $groupbuy_list[$key]['spec_quantity'] = unserialize($groupbuy['spec_quantity']);
         $groupbuy['default_image'] || ($groupbuy_list[$key]['default_image'] = Conf::get('default_goods_image'));
     }
     //dump($groupbuy_list);
     /* 当前位置 */
     $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_groupbuy'), 'index.php?app=buyer_groupbuy', LANG::get('groupbuy_list'));
     /* 当前用户中心菜单 */
     $this->_curitem('my_groupbuy');
     /* 当前所处子菜单 */
     $this->_curmenu('groupbuy_list');
     $this->_format_page($page);
     $this->assign('page_info', $page);
     //将分页信息传递给视图,用于形成分页条
     $this->assign('groupbuy_list', $groupbuy_list);
     $this->assign('state', array('all' => Lang::get('group_all'), 'on' => Lang::get('group_on'), 'end' => Lang::get('group_end'), 'finished' => Lang::get('group_finished'), 'canceled' => Lang::get('group_canceled')));
     $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_groupbuy'));
     $this->display('buyer_groupbuy.index.html');
 }
    /**
     * fetching pages list in chumper datatables
     * @return type
     */
    public function getData()
    {
        /* fetching chumper datatables */
        return Datatable::collection(Page::All())->searchColumns('name')->orderColumns('name', 'description', 'created')->addColumn('name', function ($model) {
            return $model->name;
        })->addColumn('Created', function ($model) {
            $t = $model->created_at;
            return TicketController::usertimezone($t);
        })->addColumn('Actions', function ($model) {
            return '<span  data-toggle="modal" data-target="#deletepage' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . '</button></span>&nbsp;<a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href=pages/' . $model->slug . ' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
				<div class="modal fade" id="deletepage' . $model->id . '">
        			<div class="modal-dialog">
            			<div class="modal-content">
                			<div class="modal-header">
                    			<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    			<h4 class="modal-title">Are You Sure ?</h4>
                			</div>
                			<div class="modal-body">
                				' . $model->name . '
                			</div>
                			<div class="modal-footer">
	                    		<button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
    			                <a href="page/delete/' . $model->id . '"><button class="btn btn-danger">delete</button></a>
			                </div>
		            	</div>
			        </div>
    			</div>';
        })->make();
    }
示例#18
0
 /**
  * Edit a role
  */
 public function edit()
 {
     $param = array('id' => 'edit-role-form', 'model' => 'Role', 'reference' => array('id' => $this->roleId), 'fieldsets' => array('form' => array('nofieldset' => true, new HiddenInput(array('field' => 'removable', 'default' => 1, 'readonly' => true)), new TextInput(array('field' => 'name', 'maxlength' => 32, 'label' => Lang::get('roles.form-name-label'), 'required' => true)), new ColorInput(array('field' => 'color', 'label' => Lang::get('roles.form-color-label'), 'default' => '#000'))), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get('main.valid-button'))), new DeleteInput(array('name' => 'delete', 'value' => Lang::get('main.delete-button'), 'notDisplayed' => $this->roleId == -1)), new ButtonInput(array('name' => 'cancel', 'value' => Lang::get('main.cancel-button'), 'onclick' => 'app.dialog("close")')))), 'onsuccess' => 'app.dialog("close"); app.load(app.getUri("list-roles"), {selector : "#admin-roles-tab"});');
     foreach (Language::getAll() as $language) {
         $param['fieldsets']['form'][] = new TextInput(array('name' => "translation[{$language->tag}]", "independant" => true, 'required' => $language->tag == LANGUAGE, "label" => Lang::get("roles.role-label-label", array('lang' => $language->tag)), "default" => Lang::exists("roles.role-" . $this->roleId . "-label") ? Lang::get("roles.role-" . $this->roleId . "-label", array(), 0, $language->tag) : ''));
     }
     $form = new Form($param);
     if (!$form->submitted()) {
         return View::make(Theme::getSelected()->getView("dialogbox.tpl"), array('icon' => 'user', 'title' => Lang::get('roles.form-title'), 'page' => $form));
     } else {
         if ($form->submitted() == "delete") {
             $form->delete(Form::NO_EXIT);
             if ($key) {
                 $key->delete();
             }
             return $form->response(Form::STATUS_SUCCESS);
         } else {
             if ($form->check()) {
                 try {
                     $roleId = $form->register(Form::NO_EXIT);
                     // Create the language key for the translations of the role name
                     foreach (App::request()->getBody('translation') as $tag => $translation) {
                         Language::getByTag($tag)->saveTranslations(array('roles' => array("role-{$roleId}-label" => $translation)));
                     }
                     return $form->response(Form::STATUS_SUCCESS);
                 } catch (Exception $e) {
                     return $form->response(Form::STATUS_ERROR, DEBUG_MODE ? $e->getMessage() : "");
                 }
             }
         }
     }
 }
示例#19
0
 function index()
 {
     $page = $this->_get_page(10);
     $this->_user_mod =& m('member');
     $this->_store_mod =& m('store');
     $this->_coupon_mod =& m('coupon');
     $msg = $this->_user_mod->findAll(array('conditions' => 'user_id = ' . $this->visitor->get('user_id'), 'count' => true, 'limit' => $page['limit'], 'include' => array('bind_couponsn' => array())));
     $page['item_count'] = $this->_user_mod->getCount();
     $coupon = array();
     $coupon_ids = array();
     $msg = current($msg);
     if (!empty($msg['coupon_sn'])) {
         foreach ($msg['coupon_sn'] as $key => $val) {
             $coupon_tmp = $this->_coupon_mod->get(array('fields' => "this.*,store.store_name,store.store_id", 'conditions' => 'coupon_id = ' . $val['coupon_id'], 'join' => 'belong_to_store'));
             $coupon_tmp['valid'] = 0;
             $time = gmtime();
             if ($val['remain_times'] > 0 && ($coupon_tmp['end_time'] == 0 || $coupon_tmp['end_time'] > $time)) {
                 $coupon_tmp['valid'] = 1;
             }
             $coupon[$key] = array_merge($val, $coupon_tmp);
         }
     }
     $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css'));
     /* 当前位置 */
     $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_coupon'), 'index.php?app=my_coupon', LANG::get('coupon_list'));
     $this->_curitem('my_coupon');
     $this->_curmenu('coupon_list');
     $this->assign('page_info', $page);
     //将分页信息传递给视图,用于形成分页条
     $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('coupon_list'));
     $this->_format_page($page);
     $this->assign('coupons', $coupon);
     $this->display('my_coupon.index.html');
 }
示例#20
0
 public function profileSave()
 {
     $json_request = array('status' => FALSE, 'responseText' => '', 'redirectURL' => FALSE);
     $validator = Validator::make(Input::all(), Accounts::$update_rules);
     if ($validator->passes()) {
         $post = Input::all();
         if (self::accountUpdate($post)) {
             $result = self::crmAccountUpdate($post);
             if ($result === -1) {
                 Auth::logout();
                 $json_request['responseText'] = Config::get('api.message');
                 $json_request['redirectURL'] = pageurl('auth');
                 return Response::json($json_request, 200);
             }
             $json_request['redirectURL'] = URL::route('dashboard');
             $json_request['responseText'] = Lang::get('interface.DEFAULT.success_save');
             $json_request['status'] = TRUE;
         } else {
             $json_request['responseText'] = Lang::get('interface.DEFAULT.fail');
         }
     } else {
         $json_request['responseText'] = $validator->messages()->all();
     }
     if (Request::ajax()) {
         return Response::json($json_request, 200);
     } else {
         return Redirect::route('dashboard');
     }
 }
示例#21
0
 public function page($page = FALSE)
 {
     if ($locale = Cookie::get('locale')) {
         App::setLocale($locale);
     }
     if (!$page) {
         return Redirect::to(Lang::get('navigation.consumer'), 301);
     }
     $nav = array();
     foreach (['consumer', 'exporter'] as $item) {
         $loc = Lang::get('navigation.' . $item);
         $link = strtolower(str_replace(' ', '-', $loc));
         if ($link == $page) {
             $page = $item;
         }
         $nav[$link] = ucfirst($loc);
     }
     if (!View::exists('layouts.public.' . $page)) {
         App::abort(404);
     }
     $sub_nav = array();
     $view = View::make('layouts.public.' . $page);
     switch ($page) {
         case 'exporter':
             $sub_nav = ['assortment', 'horticulture', 'certification', 'contact'];
             $picturebox = new Picturebox\PictureboxManager();
             $view->with('picturebox', $picturebox);
             break;
     }
     $view->with('sub_nav', $sub_nav);
     return $view->with('nav', $nav);
 }
示例#22
0
 /**
  * Account sign in form processing.
  *
  * @return Redirect
  */
 public function postSignin()
 {
     $this->beforeFilter('csrf', array('on' => 'post'));
     // Declare the rules for the form validation
     $rules = array('email' => 'required|email', 'password' => 'required|between:3,32');
     // Create a new validator instance from our validation rules
     $validator = Validator::make(Input::all(), $rules);
     // If validation fails, we'll exit the operation now.
     if ($validator->fails()) {
         // Ooops.. something went wrong
         return Redirect::route('signin')->withInput()->withErrors($validator);
     }
     try {
         // Try to log the user in
         $user = Sentry::authenticate(Input::only('email', 'password'), Input::get('remember-me', 0));
         // Get the page we were before
         //$redirect = Session::get('loginRedirect', 'account');
         // Unset the page we were before from the session
         //Session::forget('loginRedirect');
         // Redirect to the users page
         return Redirect::route('signin')->with('success', Lang::get('auth/message.signin.success'));
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         $this->messageBag->add('email', Lang::get('auth/message.account_not_found'));
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         $this->messageBag->add('email', Lang::get('auth/message.account_not_activated'));
     }
     // Ooops.. something went wrong
     return Redirect::route('signin')->withInput()->withErrors($this->messageBag);
 }
    /**
     * This function is used to display the list of Organizations
     * @return datatable
     */
    public function org_list()
    {
        return \Datatable::collection(Organization::all())->searchColumns('name')->orderColumns('name', 'website')->addColumn('name', function ($model) {
            return $model->name;
        })->addColumn('website', function ($model) {
            $website = $model->website;
            return $website;
        })->addColumn('phone', function ($model) {
            $phone = $model->phone;
            return $phone;
        })->addColumn('Actions', function ($model) {
            //return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
            //return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
            return '<span  data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href="' . route('organizations.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="' . route('organizations.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
				<div class="modal fade" id="deletearticle' . $model->id . '">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">Are You Sure ?</h4>
                </div>
                <div class="modal-body">
                ' . $model->user_name . '
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
                    <a href="' . route('org.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>';
        })->make();
    }
示例#24
0
 function index()
 {
     $conditions = $this->_get_query_conditions(array(array('field' => 'gb.group_name', 'equal' => 'LIKE', 'assoc' => 'AND', 'name' => 'group_name', 'type' => 'string'), array('field' => 'gb.state', 'name' => 'type', 'assoc' => 'AND', 'handler' => 'groupbuy_state_translator')));
     $page = $this->_get_page(10);
     $groupbuys_list = $this->_groupbuy_mod->find(array('conditions' => "1 = 1" . $conditions, 'join' => 'belong_store', 'fields' => 'this.*,s.store_name', 'limit' => $page['limit'], 'order' => 'group_id DESC', 'count' => true));
     $groupbuys = array();
     if ($ids = array_keys($groupbuys_list)) {
         $quantity = $this->_groupbuy_mod->db->getAllWithIndex("SELECT group_id, sum(quantity) as quantity FROM " . DB_PREFIX . "groupbuy_log  WHERE group_id " . db_create_in($ids) . "GROUP BY group_id", array('group_id'));
     }
     foreach ($groupbuys_list as $key => $val) {
         $groupbuys[$key] = $val;
         $groupbuys[$key]['count'] = empty($quantity[$key]['quantity']) ? 0 : $quantity[$key]['quantity'];
     }
     $page['item_count'] = $this->_groupbuy_mod->getCount();
     $this->_format_page($page);
     $this->assign('types', array('all' => Lang::get('group_all'), 'pending' => Lang::get('group_pending'), 'on' => Lang::get('group_on'), 'end' => Lang::get('group_end'), 'finished' => Lang::get('group_finished'), 'canceled' => Lang::get('group_canceled')));
     $this->import_resource(array('script' => 'inline_edit.js'));
     $this->assign('type', $_GET['type']);
     $this->assign('filtered', $conditions ? 1 : 0);
     //是否有查询条件
     $this->assign('page_info', $page);
     //将分页信息传递给视图,用于形成分页条
     $this->assign('groupbuys', $groupbuys);
     $this->display('groupbuy.index.html');
 }
示例#25
0
 /**
  * @return mixed
  */
 public function ajaxLogin()
 {
     if (Request::ajax()) {
         $output = [];
         $input = Input::all();
         $data = ['email' => $input['email'], 'password' => $input['password'], 'estado' => 'activo'];
         //Reglas de los Campos de Email y Password
         $rules = ['email' => 'required|email', 'password' => 'required'];
         $validator = Validator::make($input, $rules);
         //Verificacion previa de los campos, antes de la Autenticacion
         if ($validator->fails()) {
             $output['status'] = 'error';
             $output['msg'] = $validator->getMessageBag()->toArray();
         }
         $data = ['email' => $input['email'], 'password' => $input['password'], 'estado' => 'activo'];
         // Check if  exists in database with the credentials of not
         if (Auth::personales()->attempt($data)) {
             $event = Event::fire('auth.login', Auth::personales()->get());
             $output['status'] = 'success';
             $output['msg'] = Lang::get('messages.loginSuccess');
             return Response::json($output, 200);
         }
         // For Blocked Users
         $data['estado'] = 'inactive';
         if (Auth::personales()->validate($data)) {
             $output['status'] = 'error';
             $output['msg'] = ['error' => Lang::get('messages.loginBlocked')];
         } else {
             $output['status'] = 'error';
             $output['msg'] = ['error' => Lang::get('messages.loginInvalid')];
         }
         return Response::json($output, 200);
     }
 }
示例#26
0
 public function showIndex()
 {
     $campaigns = Campaign::all();
     $this->layout->content = View::make('public.home.index');
     $this->layout->content->campaigns = $campaigns;
     $this->layout->content_title = Lang::get('campaigns.list');
 }
 /**
  * ユーザーにメールを送信
  *
  * @para $name メールの識別子 $params 差し込むデータ $to 送り先(指定しなければ langの値を使用) $options Fuel準拠のEmailオプション
  * @access protected
  * @return bool
  * @author kobayasi
  * @author shimma
  */
 public function sendMailByParams($name, $params = array(), $to = null, $options = null)
 {
     Lang::load("email/{$name}");
     $email = Email::forge();
     $email->from(Lang::get('from'), Lang::get('from_name'));
     $email->subject($this->renderTemplate(Lang::get('subject'), $params, false));
     $email->body($this->renderTemplate(Lang::get('body'), $params));
     if (!$to) {
         $to = Lang::get('email');
     }
     $email->to($to);
     if (Lang::get('bcc') != '') {
         $email->bcc(Lang::get('bcc'));
     }
     if (!empty($options)) {
         foreach ($options as $option => $value) {
             if (empty($value)) {
                 continue;
             }
             switch ($option) {
                 case 'bcc':
                     $email->bcc($value);
                     break;
                 case 'reply_to':
                     $email->reply_to($value);
                     break;
                 case 'subject':
                     $email->subject($value);
                     break;
             }
         }
     }
     return $email->send();
 }
示例#28
0
 public function auth()
 {
     if (Auth::attempt(Input::except('_token'))) {
         return Redirect::route('home');
     }
     return Redirect::route('signin')->with('error', Lang::get('user.signin.error'))->withInput();
 }
示例#29
0
 /**
  * Test for Lang::set()
  *
  * @test
  */
 public function test_set()
 {
     Lang::set('testing_set_valid', 'Ahoy :name!');
     $output = Lang::get('testing_set_valid', array('name' => 'Bob'));
     $expected = 'Ahoy Bob!';
     $this->assertEquals($expected, $output);
 }
/**
 * @param array                    $params
 * @param Smarty_Internal_Template $smarty
 *
 * @throws SmartyException
 *
 * @author Kovács Vince
 */
function smarty_function_datatable_column($params, Smarty_Internal_Template &$smarty)
{
    if (!class_exists('Datatable')) {
        throw new SmartyException('chumper/datatable not installed');
    }
    if (!isset($params['label']) && !isset($params['token'])) {
        throw new SmartyException('Missing label or token attribute for datatable_column tag');
    }
    $tables = $smarty->getVariable('datatables')->value;
    $table = end($tables);
    $table->addColumn(isset($params['label']) ? $params['label'] : Lang::get($params['token']));
    $options = array();
    if (isset($params['sortable'])) {
        $options['sortable'] = (bool) $params['sortable'];
    }
    if (isset($params['orderable'])) {
        $options['orderable'] = (bool) $params['orderable'];
    }
    if (isset($params['width'])) {
        $options['width'] = $params['width'];
    }
    if (isset($params['class'])) {
        $options['className'] = $params['class'];
    }
    if (isset($params['type']) && in_array($params['type'], array('html', 'string', 'numeric', 'date'))) {
        $options['cellType'] = $params['type'];
    }
    $tableOptions = $table->getOptions();
    $tableOptions['columns'][] = count($options) == 0 ? null : $options;
    $table->setOptions($tableOptions);
}