本文整理汇总了PHP中SSP类的典型用法代码示例。如果您正苦于以下问题:PHP SSP类的具体用法?PHP SSP怎么用?PHP SSP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SSP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax_list
public function ajax_list($limit = 0)
{
$post = $this->input->post();
$export = false;
if (isset($post["isExport"])) {
$post = json_decode($post["lastPost"], true);
$export = $post["export"] = true;
}
$columns = array(array('db' => 'name', 'dt' => 0), array('db' => 'role', 'dt' => 1), array('db' => 'email', 'dt' => 2), array('db' => 'creation_date', 'dt' => 3, 'formatter' => function ($d, $row) {
return date('jS M y', strtotime($d));
}), array('db' => 'id', 'dt' => 4, 'formatter' => function ($d, $row) {
$op = array();
if (hasAccess("adminusers", "edit")) {
$op[] = '<a href="' . site_url('admin/adminusers/edit/' . $d) . '" class="fa fa-edit"></a> ';
}
/*if (hasAccess("adminusers","delete"))
$op[] = '<a href="javascript:void(0);" onclick="delete_user('.$d.')" class="fa fa-trash-o"></a>';*/
return implode(" / ", $op);
}));
if (!$export) {
echo json_encode(SSP::simple($post, ADMIN, "id", $columns));
exit;
} else {
$exportColumns = array("name" => "Name", "role" => "Role", "email" => "Email");
$data = SSP::simple($post, ADMIN, "id", $columns);
$this->load->library("excel");
$this->excel->setActiveSheetIndex(0);
$this->excel->stream('adminusers.xls', $data, $exportColumns);
}
}
示例2: ajax_list
public function ajax_list($limit = 0)
{
$post = $this->input->post();
$export = false;
if (isset($post["isExport"])) {
$post = json_decode($post["lastPost"], true);
$export = $post["export"] = true;
}
$i = 0;
$columns = array(array('db' => 'cm_uname', 'dt' => $i++), array('db' => 'cm_uemail', 'dt' => $i++), array('db' => 'cm_umobile', 'dt' => $i++), array('db' => 'cm_ucity', 'dt' => $i++), array('db' => 'cm_ucomment', 'dt' => $i++), array('db' => 'cm_date', 'dt' => $i++, 'formatter' => function ($d, $row) {
return date('jS M y', strtotime($d));
}), array('db' => 'cm_id', 'dt' => $i++, 'formatter' => function ($d, $row) {
$op = array();
if (hasAccess("contactrequest", "view")) {
$op[] = '<a href="javascript:void(0);" onclick="view_contact(' . $d . ')" class="fa fa-list-alt"></a>';
}
if (hasAccess("contactrequest", "delete")) {
$op[] = '<a href="javascript:void(0);" onclick="delete_contact(' . $d . ')" class="fa fa-trash-o"></a>';
}
return implode(" / ", $op);
}));
if (!$export) {
echo json_encode(SSP::simple($post, CONTACT, "cm_id", $columns));
exit;
} else {
$exportColumns = array("cm_uname" => "Name", "cm_uemail" => "Email", "cm_umobile" => "Mobile number", "cm_ucity" => "City", "cm_ucomment" => "Message", "cm_date" => "Date");
$data = SSP::simple($post, CONTACT, "cm_id", $columns);
$this->load->library("excel");
$this->excel->setActiveSheetIndex(0);
$this->excel->stream('contact_request.xls', $data, $exportColumns);
}
}
示例3: getdata
public function getdata()
{
$table = '`group`';
$primaryKey = 'id';
$columns = array(array('db' => 'id', 'dt' => 'DT_RowId', 'formatter' => function ($d, $row) {
return 'row_' . $d;
}, 'field' => 'id'), array('db' => 'id', 'dt' => 0, 'field' => 'id'), array('db' => 'name', 'dt' => 1, 'field' => 'name'), array('db' => 'null', 'dt' => 2));
require 'ssp.ado.class.php';
echo json_encode(SSP::simple($this->cfg->dbcnx, $_GET, $table, $primaryKey, $columns, $joinQuery));
}
示例4: get_remote
public function get_remote()
{
$table = 'access_level';
// Table's primary key
$primaryKey = 'id';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(array('db' => 'level_name', 'dt' => 0), array('db' => 'description', 'dt' => 1), array('db' => 'indicator', 'dt' => 2));
// SQL server connection information
$CI =& get_instance();
$sql_details = array('user' => $CI->db->username, 'pass' => $CI->db->password, 'db' => $CI->db->database, 'host' => $CI->db->hostname);
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
}
示例5: mysql_error
if (!$result_sql) {
echo 'Invalid query: ' . mysql_error();
} else {
echo "success";
}
} else {
echo 'Invalid query: ' . mysql_error();
}
}
if ($type == 'get_button_list') {
$table = 'share_buttons';
$primaryKey = 'bid';
$columns = array(array('db' => 'b_title', 'dt' => 'b_title'), array('db' => 'b_target_id', 'dt' => 'b_target_id'), array('db' => 'b_content', 'dt' => 'b_content'), array('db' => 'page_id', 'dt' => 'page_id'), array('db' => 'bid', 'dt' => 'bid'));
$extraWhere = " shop='" . mysql_real_escape_string($shop) . "' ";
require 'ssp.class.php';
$arr = SSP::complex($_POST, $sql_details, $table, $primaryKey, $columns, null, $extraWhere);
$json = $arr;
print_r(json_encode($json));
}
if ($type == 'search_p') {
$search_text = trim($_REQUEST['ss']);
$search_collection_id = trim($_REQUEST['sc']);
$search_type = trim($_REQUEST['st']);
$page = trim($_REQUEST['page']);
$limit_str = 10;
if ($search_type == "all_coll") {
$search_peram = "?limit=" . $limit_str . "&page=" . $page;
$search_products_data = $sc->call('GET', '/admin/products.json?collection_id=' . $search_collection_id . $search_peram);
$total_prod_count = $sc->call('GET', '/admin/products.json?collection_id=' . $search_collection_id);
$total_prod_count = intval($total_prod_count);
} else {
示例6: array
// DB table to use
$table = 'modx_activations';
// Table's primary key
$primaryKey = 'id';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(array('db' => 'id', 'dt' => 'DT_RowId', 'formatter' => function ($d, $row) {
// Technically a DOM id cannot start with an integer, so we prefix
// a string. This can also be useful if you have multiple tables
// to ensure that the id is unique with a different prefix
return 'row_' . $d;
}), array('db' => 'act_date', 'dt' => 0, 'formatter' => function ($d, $row) {
return !empty($d) ? date('d.m.Y', $d) : "";
}), array('db' => 'pc_id', 'dt' => 1, 'formatter' => function ($d, $row) {
global $modx;
return $modx->runSnippet('pdoField', array('id' => $d, 'field' => 'pagetitle'));
}), array('db' => 'abonent', 'dt' => 2), array('db' => 'bonus_set', 'dt' => 3, 'formatter' => function ($d, $row) {
return !empty($d) ? $d . " руб." : "";
}));
// SQL server connection information
$sql_details = array('user' => 'mgmbee', 'pass' => 'mB915009', 'db' => 'mgm', 'host' => 'node100241-blogger.jelastic.regruhosting.ru');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP
* server-side, there is no need to edit below this line.
*/
require MODX_CORE_PATH . 'components/datatables/server_side/scripts/ssp.class.php';
$beeWhere = array($_POST['beeWhere']);
echo json_encode(SSP::complex($_POST, $sql_details, $table, $primaryKey, $columns, null, $beeWhere));
示例7: array
$columns = array(array('db' => 'id', 'dt' => 0), array('db' => 'original_id', 'dt' => 1), array('db' => 'addres', 'dt' => 2), array('db' => 'start_date', 'dt' => 3), array('db' => 'end_date', 'dt' => 4), array('db' => 'task_type_name', 'dt' => 5), array('db' => 'shabloni_name', 'dt' => 6), array('db' => 'first_last_name', 'dt' => 7), array('db' => 'person_name', 'dt' => 8), array('db' => 'prio_name', 'dt' => 9), array('db' => 'note', 'dt' => 10));
// SQL server connection information
$sql_details = array('user' => 'root', 'pass' => 'Gl-1114', 'db' => 'asteriskcdrdb', 'host' => 'localhost');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP
* server-side, there is no need to edit below this line.
*/
mysql_close();
require '../../../../includes/ssp.class.php';
if ($_REQUEST[check] != '') {
$dadebit = "";
} else {
$dadebit = "";
}
$where_param = "";
$data = SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $where_param);
break;
case 'delete_file':
mysql_query("DELETE FROM file WHERE id = {$delete_id}");
$increm = mysql_query("\tSELECT `name`,\r\n \t\t\t`rand_name`,\r\n \t\t\t`id`\r\n \t\t\tFROM \t`file`\r\n \t\t\tWHERE `task_id` = {$edit_id}\r\n \t\t\t");
$data1 = '';
while ($increm_row = mysql_fetch_assoc($increm)) {
$data1 .= '<tr style="border-bottom: 1px solid #85b1de;">
<td style="width:110px; display:block;word-wrap:break-word;">' . $increm_row[name] . '</td>
<td ><button type="button" value="media/uploads/file/' . $increm_row[rand_name] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none;background-image:url(\'media/images/get.png\');" id="download" ></button><input type="text" style="display:none;" id="download_name" value="' . $increm_row[rand_name] . '"> </td>
<td ><button type="button" value="' . $increm_row[id] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none; background-image:url(\'media/images/x.png\');" id="delete"></button></td>
</tr>';
}
$data = array('page' => $data1);
break;
case 'up_now':
示例8: get_table_group
function get_table_group($table, $primaryKey, $columns, $where, $group)
{
$config = new config();
$sql_details = $config->sql_details();
require 'ssp.class.php';
echo json_encode(SSP::simplewheregroup($_POST, $sql_details, $table, $primaryKey, $columns, $where, $group));
}
示例9: get_table_join
function get_table_join($table, $table2, $primaryKey, $columns, $on, $where, $group, $dataArray)
{
$config = new config();
$sql_details = $config->sql_details();
require 'ssp.class.php';
echo json_encode(SSP::complexjoin($_POST, $sql_details, $table, $table2, $primaryKey, $columns, $on, $where, $group, $dataArray));
}
示例10: galleries_table
function galleries_table()
{
//ajax call function
if (!$_REQUEST) {
return false;
}
$baseSql = "\n\t\t\tSELECT \n\t\t\t\tCASE g.type \n\t\t\t\t\tWHEN 1 THEN 'Gallery 1'\n\t\t\t\t\tWHEN 2 THEN 'Gallery 2'\n\t\t\t\t\tWHEN 3 THEN 'Gallery 3'\n\t\t\t\t\tWHEN 4 THEN 'Gallery 4'\n\t\t\t\t\tELSE 'Gallery'\n\t\t\t\tEND AS 'Type',\n\t\t\t\tg.gallery_id,\n\t\t\t\tg.gallery_title as 'Title',\n\t\t\t\tg.url as 'URL',\n\t\t\t\tg.category as 'Category',\n\t\t\t\tg.author_id,\n\t\t\t\tg.created as 'Date Created',\n\t\t\t\tu.username as 'Author',\n\t\t\t\t'' as 'Image'\n\t\t\tFROM\n\t\t\t\tgallery g\n\t\t\tLEFT JOIN\n\t\t\t\tusername u\n\t\t\tON\n\t\t\t\tg.user_id = u.id\n\t\t";
//List all of your columns here
$columns = array('Title', 'URL', 'Type', 'Category', 'Author', 'Image', 'Date Created');
$functions = array();
/*
* adding functions is not required. This is just a way to run functions on the data if you wish.
* This will take the target which is the Image row from the query, and change it to the "replace" string.
* You can use part of the query to build the replace using {} and passing them in the params.
*/
$functions[] = array('function' => 'editRow', 'target' => 'Image', 'replace' => '<img src="www.mysite.com/{gallery_id}" alt="{Title}">', 'params' => array('gallery_id', 'Title'));
/*
* Add this to change the date format. Simply put in the date format
* of your column in the format_from value, and put the
* desired date format in the format_to value
* 20150101 becomes Thu: 01-01-15
*/
$functions[] = array('function' => 'date_format', 'format_to' => 'D: m-d-y', 'format_from' => 'Ymd', 'columns' => array('Date Created'));
/*
* list any columns you want to be "searchable".
* you can also list non visable data here to be searchable, such as the gallery_id.
*/
$searchable = array('Title', 'URL', 'Author', 'Category');
echo json_encode(SSP::buildTable($this->Model, $_REQUEST, $baseSql, $columns, $searchable, $functions));
}
示例11: menucat_list
public function menucat_list()
{
$sql = 'select menu_category_id,menu_category_name from menu_category';
$sql_data = $this->usermenumodel->columns($sql);
$ssp_file = 'IncludeViews/ssp.php';
require $ssp_file;
echo json_encode(SSP::simple($_POST, $sql_data['sql_details'], $sql, $sql_data['columns']));
}
示例12: zone_list
public function zone_list()
{
$sql = 'select * from country_zone';
$sql_data = $this->usermenumodel->columns($sql);
$ssp_file = 'IncludeViews/ssp.php';
require $ssp_file;
echo json_encode(SSP::simple($_POST, $sql_data['sql_details'], $sql, $sql_data['columns']));
}
示例13: usermaster_list
public function usermaster_list()
{
$sql = $this->usermastermodel->index();
$sql_data = $this->usermenumodel->columns($sql);
$ssp_file = 'IncludeViews/ssp.php';
require $ssp_file;
echo json_encode(SSP::simple($_POST, $sql_data['sql_details'], $sql, $sql_data['columns']));
}
示例14: ajax
function ajax()
{
$table = 'v_asignaturas';
$primaryKey = 'codigo';
$columns = array(array('db' => 'nombre_area_administrativa', 'dt' => 0), array('db' => 'codigo', 'dt' => 1), array('db' => 'nombre', 'dt' => 2), array('db' => 'codigo', 'dt' => 3, 'formatter' => function ($d, $row) {
return '<input type="checkbox" name="asignatura_ciclo" value="' . $d . '" onclick="$.ajax({method: \'POST\', url: \'/asignaturas_ciclo/asociar_asignatura_ciclo\', data: { asignatura: \'' . $d . '\'}})">';
}));
$sql_details = array('user' => 'root', 'pass' => 'root', 'db' => 'simapro', 'host' => 'localhost');
require 'ssp.class.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
}
示例15: ajax_list
public function ajax_list($limit = 0)
{
$post = $this->input->post();
$columns = array(array('db' => 'name', 'dt' => 0), array('db' => 'email', 'dt' => 1), array('db' => 'creation_date', 'dt' => 2, 'formatter' => function ($d, $row) {
return date('jS M y', strtotime($d));
}), array('db' => 'id', 'dt' => 3, 'formatter' => function ($d, $row) {
$op = array();
$op[] = '<a href="' . site_url('/users/edit/' . $d) . '" class="fa fa-edit"></a> ';
$op[] = '<a href="javascript:void(0);" onclick="delete_user(' . $d . ')" class="fa fa-trash-o"></a>';
return implode(" / ", $op);
}));
echo json_encode(SSP::simple($post, USER, "id", $columns));
exit;
}