本文整理汇总了PHP中SiteHelpers::CF_encode_json方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteHelpers::CF_encode_json方法的具体用法?PHP SiteHelpers::CF_encode_json怎么用?PHP SiteHelpers::CF_encode_json使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteHelpers
的用法示例。
在下文中一共展示了SiteHelpers::CF_encode_json方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postConn
public function postConn(Request $request)
{
$id = $request->input('module_id');
$field_id = $request->input('field_id');
$alias = $request->input('alias');
$row = \DB::table('tb_module')->where('module_id', $id)->get();
if (count($row) <= 0) {
return Redirect::to($this->module)->with('messagetext', 'Can not find module')->with('msgstatus', 'error');
}
$row = $row[0];
$this->data['row'] = $row;
$fr = array();
$config = \SiteHelpers::CF_decode_json($row->module_config);
foreach ($config['grid'] as $form) {
if ($form['field'] == $field_id && $form['alias'] == $alias) {
if ($request->input('db') != '') {
$value = implode("|", $request->input('display'));
$form['conn'] = array('valid' => '1', 'db' => $request->input('db'), 'key' => $request->input('key'), 'display' => implode("|", array_filter($request->input('display'))));
} else {
$form['conn'] = array('valid' => '0', 'db' => '', 'key' => '', 'display' => '');
}
$fr[] = $form;
} else {
$fr[] = $form;
}
}
unset($config["grid"]);
$new_config = array_merge($config, array("grid" => $fr));
$affected = \DB::table('tb_module')->where('module_id', '=', $id)->update(array('module_config' => \SiteHelpers::CF_encode_json($new_config)));
return Redirect::to('sximo/module/table/' . $row->module_name)->with('messagetext', 'Module Forms Has Changed Successful.')->with('msgstatus', 'success');
}
示例2: getRemovesub
function getRemovesub()
{
$id = Input::get('id');
$module = Input::get('mod');
$row = DB::table('tb_module')->where('module_id', $id)->get();
if (count($row) <= 0) {
return Redirect::to($this->module)->with('messagetext', 'Can not find module')->with('msgstatus', 'error');
}
$row = $row[0];
$this->data['row'] = $row;
$config = SiteHelpers::CF_decode_json($row->module_config);
$subgrid = array();
foreach ($config['subgrid'] as $sb) {
if ($sb['module'] != $module) {
$subgrid[] = $sb;
}
}
unset($config["subgrid"]);
$new_config = array_merge($config, array("subgrid" => $subgrid));
//echo '<pre>'; print_r($new_config); echo '</pre>'; exit;
$affected = DB::table('tb_module')->where('module_id', '=', $id)->update(array('module_config' => SiteHelpers::CF_encode_json($new_config)));
return Redirect::to($this->module . '/sub/' . $row->module_name)->with('messagetext', 'Master Has removed Successful.')->with('msgstatus', 'success');
}
示例3:
</div>
<div class="right-column-sub">
<div class="banner">
<img src="{{ URL::asset('images/duh-add.jpg') }}" alt="">
<!--banner --></div>
<div class="featured-head">
<h2>FEATURED</h2>
@if(count($featured))
@foreach($featured as $fkey)
<?php
/*params*/
$fp[0] = $fkey->fk_category_id;
$fp[1] = $fkey->fk_sub_category_id;
$fp[2] = $fkey->pk_poll_id;
$fpArr = SiteHelpers::CF_encode_json($fp);
?>
<div class="tab-sub-section">
<div class="soon-image">
<img src="{{ URL::asset('uploads/polls/thumb/'.$fkey->thumbnail) }}" alt="">
</div>
<div class="soon-des">
<a href = "{{URL::to('poll/'.$fpArr)}}" class = "single-poll">{{$fkey->title}}</a>
</div>
</div>
@endforeach
@else
{{"No Featured Polls"}}
@endif
<!--featured-head --></div>
示例4: saveConn
function saveConn()
{
$id = $this->input->post('module_id');
$field_id = $this->input->post('field_id', true);
$alias = $this->input->post('alias', true);
$row = $this->db->get_where('tb_module', array('module_id' => $id))->row();
if (count($row) <= 0) {
redirect('sximo/module', 301);
}
$this->data['row'] = $row;
$fr = array();
$config = SiteHelpers::CF_decode_json($row->module_config);
foreach ($config['grid'] as $form) {
if ($form['field'] == $field_id && $form['alias'] == $alias) {
if ($this->input->post('db') != '') {
$value = implode("|", $this->input->post('display', true));
$form['conn'] = array('valid' => '1', 'db' => $this->input->post('db', true), 'key' => $this->input->post('key', true), 'display' => implode("|", array_filter($this->input->post('display', true))));
} else {
$form['conn'] = array('valid' => '0', 'db' => '', 'key' => '', 'display' => '');
}
$fr[] = $form;
} else {
$fr[] = $form;
}
}
unset($config["grid"]);
$new_config = array_merge($config, array("grid" => $fr));
// echo '<pre>'; print_r($new_config); echo '</pre>'; exit;
$this->db->where('module_id', $id);
$this->db->update('tb_module', array('module_config' => SiteHelpers::CF_encode_json($new_config)));
$this->session->set_flashdata('message', SiteHelpers::alert('success', 'Module Table Connection Has Been Save Successfull'));
redirect('sximo/module/table/' . $row->module_name, 301);
}
示例5: array
<li>contest based</li>
<li>votes: 14,57,000</li>
</ul>
</div>
</div>
<!--soon-section --></div>
@endforeach
<!--featured-polls --></div>
@endif
@if(isset($closed) && !empty($closed))
<?php
$closedArr = array();
$closedArr[0] = $categoryId;
$closedArr[1] = $subCatId;
$closedArr[2] = 'closed';
$cArr = SiteHelpers::CF_encode_json($closedArr);
?>
<div class="closed-polls">
<h2><span>CLOSED POLLS</span> <div class="view-more"><a href="{{URL::to('/viewall/'.$cArr)}}">view more</a></div></h2>
<ul>
@foreach($closed as $c)
<li>{{$c->title}}(<span>contest based votes 14,57,000</span>)</li>
@endforeach
</ul>
<!--closed-polls --></div>
@endif
<!--middle-column --></div>
<div class="right-column">
示例6:
<?php
$categories = SiteHelpers::mainCategory('category');
$currentRoute = Route::current();
$parameters = $currentRoute->parameters();
$linkSelect = SiteHelpers::CF_encode_json($parameters);
if ($parameters) {
$cat = SiteHelpers::CF_decode_json($parameters['one']);
if (is_array($cat)) {
$categoryId = $cat[1];
} else {
$categoryId = $cat;
}
} else {
$categoryId = 'all';
}
/*if($params)
{
}*/
$subCategories = SiteHelpers::mainCategory($categoryId);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
<title>:: The Indian Edition ::</title>
<link type="text/css" rel="stylesheet" href="{{ URL::asset('css/layout.css') }}">
<link type="text/css" rel="stylesheet" href="{{ URL::asset('css/iPad.css') }}">
<link type="text/css" rel="stylesheet" href="{{ URL::asset('css/mobile-small.css') }}">
示例7: postCreate
function postCreate()
{
$rules = array('module_name' => 'required|alpha|min:2|unique:tb_module', 'module_title' => 'required', 'module_note' => 'required', 'module_db' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$table = Input::get('module_db');
$primary = self::findPrimarykey(Input::get('module_db'));
$select = Input::get('sql_select');
$where = Input::get('sql_where');
$group = Input::get('sql_group');
if (Input::get('creation') == 'manual') {
if ($where == "") {
return Redirect::to($this->module . '/add')->withErrors($validator)->withInput()->with('message', SiteHelpers::alert('error', "SQL WHERE REQUIRED"));
}
try {
DB::select($select . ' ' . $where . ' ' . $group);
} catch (\Exception $e) {
// Do something when query fails.
$error = 'Error : ' . $select . ' ' . $where . ' ' . $group;
return Redirect::to($this->module . '/add')->withErrors($validator)->withInput()->with('message', SiteHelpers::alert('error', $error));
}
$columns = array();
$results = $this->model->getColoumnInfo($select . ' ' . $where . ' ' . $group);
//echo '<pre>'; print_r($results); echo '</pre>'; exit;
$primary_exits = '';
foreach ($results as $r) {
$Key = isset($r['flags'][1]) && $r['flags'][1] == 'primary_key' ? 'PRI' : '';
if ($Key != '') {
$primary_exits = $r['name'];
}
$columns[] = (object) array('Field' => $r['name'], 'Table' => $r['table'], 'Type' => $r['native_type'], 'Key' => $Key);
}
$primary = $primary_exits != '' ? $primary_exits : '';
} else {
$columns = DB::select("SHOW COLUMNS FROM " . Input::get('module_db'));
$select = " SELECT {$table}.* FROM {$table} ";
$where = " WHERE " . $table . "." . $primary . " IS NOT NULL";
if ($primary != '') {
$where = " WHERE " . $table . "." . $primary . " IS NOT NULL";
} else {
$where = '';
}
}
// echo '<pre>'; print_r($columns); echo '</pre>'; exit;
$i = 0;
$rowGrid = array();
$rowForm = array();
foreach ($columns as $column) {
if (!isset($column->Table)) {
$column->Table = $table;
}
if ($column->Key == 'PRI') {
$column->Type = 'hidden';
}
if ($column->Table == $table) {
$form_creator = self::configForm($column->Field, $column->Table, $column->Type, $i);
$relation = self::buildRelation($table, $column->Field);
foreach ($relation as $row) {
$array = array('external', $row['table'], $row['column']);
$form_creator = self::configForm($column->Field, $table, 'select', $i, $array);
}
$rowForm[] = $form_creator;
}
$rowGrid[] = self::configGrid($column->Field, $column->Table, $column->Type, $i);
$i++;
}
$setting = array('gridtype' => Input::get('module_template'), 'orderby' => $primary, 'ordertype' => 'asc', 'perpage' => '10', 'frozen' => 'false');
// echo '<pre>'; print_r($rowGrid); echo '</pre>'; exit;
$json_data['sql_select'] = $select;
$json_data['sql_where'] = $where;
$json_data['sql_group'] = $group;
$json_data['table_db'] = $table;
$json_data['primary_key'] = $primary;
$json_data['grid'] = $rowGrid;
$json_data['forms'] = $rowForm;
$json_data['setting'] = $setting;
//echo '<pre>'; print_r($json_data); echo '</pre>'; exit;
$data = array('module_name' => Input::get('module_name'), 'module_title' => Input::get('module_title'), 'module_note' => Input::get('module_note'), 'module_db' => Input::get('module_db'), 'module_db_key' => $primary, 'module_type' => 'addon', 'module_created' => date("Y-m-d H:i:s"), 'module_config' => SiteHelpers::CF_encode_json($json_data));
DB::table('tb_module')->insert($data);
// Add Default permission
$tasks = array('is_global' => 'Global', 'is_view' => 'View ', 'is_detail' => 'Detail', 'is_add' => 'Add ', 'is_edit' => 'Edit ', 'is_remove' => 'Remove ', 'is_excel' => 'Excel ');
$groups = DB::table('tb_groups')->get();
$row = DB::table('tb_module')->where('module_name', Input::get('module_name'))->get();
if (count($row) >= 1) {
$id = $row[0];
foreach ($groups as $g) {
$arr = array();
foreach ($tasks as $t => $v) {
if ($g->group_id == '1') {
$arr[$t] = '1';
} else {
$arr[$t] = '0';
}
}
$data = array("access_data" => json_encode($arr), "module_id" => $id->module_id, "group_id" => $g->group_id);
DB::table('tb_groups_access')->insert($data);
}
return Redirect::to($this->module . '/rebuild/' . $id->module_id);
} else {
return Redirect::to($this->module);
//.........这里部分代码省略.........
示例8: postSaveform
function postSaveform()
{
$id = Input::get('module_id');
$row = DB::table('tb_module')->where('module_id', $id)->get();
if (count($row) <= 0) {
return Redirect::to($this->module)->with('message', SiteHelpers::alert('error', 'Can not find module'));
}
$row = $row[0];
$this->data['row'] = $row;
$config = SiteHelpers::CF_decode_json($row->module_config);
$this->data['tables'] = $config['grid'];
$total = count($_POST['field']);
extract($_POST);
$f = array();
for ($i = 1; $i <= $total; $i++) {
$language = array();
$f[] = array("field" => $field[$i], "alias" => $alias[$i], "language" => $language, "label" => $label[$i], 'form_group' => $form_group[$i], 'required' => isset($required[$i]) ? $required[$i] : 0, 'view' => isset($view[$i]) ? 1 : 0, 'type' => $type[$i], 'add' => 1, 'size' => '0', 'edit' => 1, 'search' => isset($search[$i]) ? $search[$i] : 0, "sortlist" => $sortlist[$i], 'option' => array("opt_type" => $opt_type[$i], "lookup_query" => $lookup_query[$i], "lookup_table" => $lookup_table[$i], "lookup_key" => $lookup_key[$i], "lookup_value" => $lookup_value[$i], 'is_dependency' => $is_dependency[$i], 'is_multiple' => isset($is_multiple[$i]) ? $is_multiple[$i] : 0, 'lookup_dependency_key' => $lookup_dependency_key[$i], 'path_to_upload' => $path_to_upload[$i], 'resize_width' => $resize_width[$i], 'resize_height' => $resize_height[$i], 'upload_type' => $upload_type[$i], 'tooltip' => $tooltip[$i], 'attribute' => $attribute[$i], 'extend_class' => $extend_class[$i]));
}
unset($config["forms"]);
$new_config = array_merge($config, array("forms" => $f));
$data['module_config'] = SiteHelpers::CF_encode_json($new_config);
//echo '<pre>'; print_r($new_config); echo '</pre>'; exit;
/*
$affected = DB::table('tb_module')
->where('module_id', '=',$id )
->update(array('module_config' => SiteHelpers::CF_encode_json($new_config)));
*/
return Redirect::to($this->module . '/form/' . $row->module_name)->with('message', SiteHelpers::alert('success', 'Module Forms Has Changed Successful.'));
}