本文整理汇总了PHP中SiteHelpers类的典型用法代码示例。如果您正苦于以下问题:PHP SiteHelpers类的具体用法?PHP SiteHelpers怎么用?PHP SiteHelpers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SiteHelpers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postSave
function postSave($id = 0)
{
$trackUri = $this->data['trackUri'];
$rules = $this->validateForm();
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$data = $this->validatePost('tb_groups');
$ID = $this->model->insertRow($data, Input::get('group_id'));
// Input logs
if (Input::get('group_id') == '') {
$this->inputLogs("New Entry row with ID : {$ID} , Has Been Save Successfull");
$id = SiteHelpers::encryptID($ID);
} else {
$this->inputLogs(" ID : {$ID} , Has Been Changed Successfull");
}
// Redirect after save
$md = str_replace(" ", "+", Input::get('md'));
$redirect = !is_null(Input::get('apply')) ? 'groups/add/' . $id . '?md=' . $md . $trackUri : 'groups?md=' . $md . $trackUri;
return Redirect::to($redirect)->with('messagetext', Lang::get('core.note_success'))->with('msgstatus', 'success');
} else {
$md = str_replace(" ", "+", Input::get('md'));
return Redirect::to('groups/add/' . $id . '?md=' . $md)->with('messagetext', Lang::get('core.note_error'))->with('msgstatus', 'error')->withErrors($validator)->withInput();
}
}
示例2: getIndex
public function getIndex(Request $request)
{
$sort = !is_null($request->input('sort')) ? $request->input('sort') : '';
$order = !is_null($request->input('order')) ? $request->input('order') : 'asc';
// End Filter sort and order for query
// Filter Search for query
$filter = !is_null($request->input('search')) ? '' : '';
$page = $request->input('page', 1);
$params = array('page' => $page, 'limit' => !is_null($request->input('rows')) ? filter_var($request->input('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0);
// Get Query
$results = $this->model->getRows($params);
// Build pagination setting
$page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1;
$pagination = new Paginator($results['rows'], $results['total'], $params['limit']);
$pagination->setPath('esireport');
$this->data['rowData'] = $results['rows'];
// Build Pagination
$this->data['pagination'] = $pagination;
// Build pager number and append current param GET
$this->data['pager'] = $this->injectPaginate();
// Row grid Number
$this->data['i'] = $page * $params['limit'] - $params['limit'];
// Grid Configuration
$this->data['tableGrid'] = $this->info['config']['grid'];
$this->data['tableForm'] = $this->info['config']['forms'];
$this->data['colspan'] = \SiteHelpers::viewColSpan($this->info['config']['grid']);
// Group users permission
$this->data['access'] = $this->access;
// Detail from master if any
// Master detail link if any
$this->data['subgrid'] = isset($this->info['config']['subgrid']) ? $this->info['config']['subgrid'] : array();
// Render into template
return view('esireport.index', $this->data);
}
示例3: dc_addition
public static function dc_addition($id)
{
//get the delivery object
$delivery_object = DB::table('tb_request_delivery')->where('id', $id)->first();
$user_id = \SiteHelpers::getUserIdFromCustomerId($delivery_object->cid);
DB::table('tb_request_delivery')->where('id', $id)->update(['parcel_delivery_code' => \SiteHelpers::delivery_code($user_id)]);
}
示例4: postSave
function postSave(Request $request, $id = 0)
{
$rules = array('menu_name' => 'required', 'active' => 'required', 'menu_type' => 'required', 'position' => 'required');
$validator = Validator::make($request->all(), $rules);
if ($validator->passes()) {
$pos = $request->input('position');
$data = $this->validatePost('tb_menu');
if (CNF_MULTILANG == 1) {
$lang = \SiteHelpers::langOption();
$language = array();
foreach ($lang as $l) {
if ($l['folder'] != 'en') {
$menu_lang = isset($_POST['language_title'][$l['folder']]) ? $_POST['language_title'][$l['folder']] : '';
$language['title'][$l['folder']] = $menu_lang;
}
}
$data['menu_lang'] = json_encode($language);
}
$arr = array();
$groups = \DB::table('tb_groups')->get();
foreach ($groups as $g) {
$arr[$g->group_id] = isset($_POST['groups'][$g->group_id]) ? "1" : "0";
}
$data['access_data'] = json_encode($arr);
$data['allow_guest'] = $request->input('allow_guest');
$this->model->insertRow($data, $request->input('menu_id'));
return Redirect::to('sximo/menu?pos=' . $pos)->with('messagetext', 'Data Has Been Save Successfull')->with('msgstatus', 'success');
} else {
return Redirect::to('sximo/menu?pos=' . $pos)->with('messagetext', 'The following errors occurred')->with('msgstatus', 'error')->withErrors($validator)->withInput();
}
}
示例5: getIndex
public function getIndex()
{
if ($this->access['is_view'] == 0) {
return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
}
// Filter sort and order for query
$sort = !is_null(Input::get('sort')) ? Input::get('sort') : '';
$order = !is_null(Input::get('order')) ? Input::get('order') : 'asc';
// End Filter sort and order for query
// Filter Search for query
$filter = !is_null(Input::get('search')) ? $this->buildSearch() : '';
// End Filter Search for query
$page = Input::get('page', 1);
$params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0);
// Get Query
$results = $this->model->getRows($params);
// Build pagination setting
$page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1;
$pagination = Paginator::make($results['rows'], $results['total'], $params['limit']);
$this->data['rowData'] = $results['rows'];
// Build Pagination
$this->data['pagination'] = $pagination;
// Build pager number and append current param GET
$this->data['pager'] = $this->injectPaginate();
// Row grid Number
$this->data['i'] = $page * $params['limit'] - $params['limit'];
// Grid Configuration
$this->data['tableGrid'] = $this->info['config']['grid'];
$this->data['tableForm'] = $this->info['config']['forms'];
$this->data['colspan'] = SiteHelpers::viewColSpan($this->info['config']['grid']);
// Group users permission
$this->data['access'] = $this->access;
// Render into template
$this->layout->nest('content', 'rinvoices.index', $this->data)->with('menus', SiteHelpers::menus());
}
示例6: postData
public function postData()
{
if ($this->access['is_view'] == 0) {
echo SiteHelpers::alert('error', Lang::get('core.note_restric'));
die;
}
$sort = !is_null(Input::get('sort')) ? Input::get('sort') : $this->info['setting']['orderby'];
$order = !is_null(Input::get('order')) ? Input::get('order') : $this->info['setting']['ordertype'];
$filter = !is_null(Input::get('search')) ? $this->buildSearch() : '';
$page = Input::get('page', 1);
$params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : $this->info['setting']['perpage'], 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0);
$results = $this->model->getRows($params);
$this->data['param'] = $params;
$this->data['rowData'] = $results['rows'];
$this->data['tableGrid'] = $this->info['config']['grid'];
$this->data['tableForm'] = $this->info['config']['forms'];
$this->data['access'] = $this->access;
$this->data['subgrid'] = isset($this->info['config']['subgrid']) ? $this->info['config']['subgrid'] : array();
$this->data['masterdetail'] = $this->masterDetailParam();
// Build pagination setting
$page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1;
$pagination = Paginator::make($results['rows'], $results['total'], $params['limit']);
// Build Pagination
$this->data['pagination'] = $pagination;
// Build pager number and append current param GET
$this->data['pager'] = $this->injectPaginate();
// Row grid Number
$this->data['i'] = $page * $params['limit'] - $params['limit'];
return View::make('areportinvoices.table', $this->data);
}
示例7: getDelete
public function getDelete($id = null)
{
if (!is_null($id)) {
$id = SiteHelpers::encryptID($id, true);
PlotModel::where('id', $id)->delete();
return Redirect::to('plot')->with('message', SiteHelpers::alert('success', "Data deleted esuccessfully"));
}
}
示例8: getDelete
public function getDelete($id = null)
{
if (!is_null($id)) {
$id = SiteHelpers::encryptID($id, true);
$del = FileModel::where('id', $id)->first();
@unlink(public_path('uploads/' . $del->filename));
FileModel::where('id', $id)->delete();
return Redirect::to('files')->with('message', SiteHelpers::alert('success', "Data deleted successfully"));
}
}
示例9: getDestroy
public function getDestroy()
{
$ids = Input::get('del');
$i = 0;
foreach ($ids as $id) {
$del = FileModel::where('id', $id)->first();
@unlink(public_path('uploads/' . $del->filename));
FileModel::where('id', $id)->delete();
$i++;
}
return Redirect::to('files')->with('message', SiteHelpers::alert('success', $i . " Data deleted successfully"));
}
示例10: view
public static function view($class)
{
$id = Input::get('id');
$id = SiteHelpers::encryptID($id, true);
$results = $class::getRow($id);
if (count($results) >= 1) {
$config = $class::makeInfo($class);
$data['tableGrid'] = $config['config']['grid'];
$data['row'] = $results;
return View::make('public.view', $data);
} else {
return "NO PAGE FOUND !";
}
}
示例11: getShow
function getShow($id = null)
{
if ($this->access['is_detail'] == 0) {
return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
}
$ids = $id == null ? '' : SiteHelpers::encryptID($id, true);
$row = $this->model->getRow($ids);
if ($row) {
$this->data['row'] = $row;
} else {
$this->data['row'] = $this->model->getColumnTable('tb_users');
}
$this->data['id'] = $id;
$this->data['access'] = $this->access;
$this->layout->nest('content', 'users.view', $this->data)->with('menus', $this->menus);
}
示例12: index
public function index(Request $request)
{
$check = self::authentication($request);
if (is_array($check)) {
return \Response::json($check);
} else {
$class = ucwords($request->input('module'));
$config = $this->model->makeInfo($class);
$tables = $config['config']['grid'];
$page = (!is_null($request->input('page')) or $request->input('page') != 0) ? $request->input('page') : 1;
$param = array('page' => $page, 'sort' => '', 'order' => 'asc', 'limit' => '');
if (!is_null($request->input('limit')) or $request->input('limit') != 0) {
$param['limit'] = $request->input('limit');
}
if (!is_null($request->input('order'))) {
$param['order'] = $request->input('order');
}
if (!is_null($request->input('sort'))) {
$param['sort'] = $request->input('sort');
}
$results = $this->model->getRows($param);
$json = array();
foreach ($results['rows'] as $row) {
$rows = array();
foreach ($tables as $table) {
$conn = isset($table['conn']) ? $table['conn'] : array();
$rows[$table['field']] = \SiteHelpers::gridDisplay($row->{$table}['field'], $table['field'], $conn);
//$rows[$table['field']] = '';
}
$json[] = $rows;
}
$jsonData = array('total' => $results['total'], 'rows' => $json, 'control' => $param, 'key' => $config['key']);
if (!is_null($request->input('option')) && $request->input('option') == 'true') {
$label = array();
foreach ($tables as $table) {
$label[] = $table['label'];
}
$field = array();
foreach ($tables as $table) {
$field[] = $table['field'];
}
$jsonData['option'] = array('label' => $label, 'field' => $field);
}
return \Response::json($jsonData, 200);
}
}
示例13: get_zip_content
public static function get_zip_content($name, $zip)
{
$contents = '';
if (file_exists($zip)) {
$fp = fopen('zip://' . $zip . '#' . $name, 'r');
if (!$fp) {
SiteHelpers::alert("error", "cannot open zip file: {$zip}n");
}
while (!feof($fp)) {
$contents .= fread($fp, 2);
}
} else {
SiteHelpers::alert("error", "cannot find zip file: {$zip}n");
}
fclose($fp);
return $contents;
}
示例14: delete_action
public static function delete_action($ids)
{
foreach ($ids as $id) {
//get the customer ID and User ID
$delivery_object = DB::table('tb_request_delivery')->where('id', $id)->first();
$customer_id = $delivery_object->cid;
$user_id = \SiteHelpers::getUserIdFromCustomerId($customer_id);
$bill = DB::table('tb_bills')->where('delivery_id', $id)->get();
if (count($bill) == 1) {
$bill_amount = $bill[0]->bill;
//refund now
if (\SiteHelpers::is_payg_customer()) {
DB::table('tb_payg_balance')->where('user_id', $user_id)->increment('balance', $bill_amount);
//remove the bill
self::remove_bills($id);
}
}
}
}
示例15: makeInfo
static function makeInfo($id)
{
$row = \DB::table('tb_module')->where('module_name', $id)->get();
$data = array();
foreach ($row as $r) {
$data['id'] = $r->module_id;
$data['title'] = $r->module_title;
$data['note'] = $r->module_note;
$data['table'] = $r->module_db;
$data['key'] = $r->module_db_key;
$data['config'] = \SiteHelpers::CF_decode_json($r->module_config);
$field = array();
foreach ($data['config']['grid'] as $fs) {
foreach ($fs as $f) {
$field[] = $fs['field'];
}
}
$data['field'] = $field;
}
return $data;
}