本文整理汇总了PHP中element函数的典型用法代码示例。如果您正苦于以下问题:PHP element函数的具体用法?PHP element怎么用?PHP element使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了element函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_baord_group
/**
* board group 테이블에서 가져옵니다
*/
public function get_baord_group($bgr_id = 0, $bgr_key = '')
{
if (empty($bgr_id) && empty($bgr_key)) {
return false;
}
if ($bgr_id) {
$group = $this->CI->Board_group_model->get_one($bgr_id);
} elseif ($bgr_key) {
$where = array('bgr_key' => $bgr_key);
$group = $this->CI->Board_group_model->get_one('', '', $where);
} else {
return false;
}
if (element('bgr_id', $group)) {
$group_meta = $this->get_all_meta(element('bgr_id', $group));
if (is_array($group_meta)) {
$group = array_merge($group, $group_meta);
}
}
if (element('bgr_id', $group)) {
$this->group_id[element('bgr_id', $group)] = $group;
}
if (element('bgr_key', $group)) {
$this->group_key[element('bgr_key', $group)] = $group;
}
}
示例2: update_project
public function update_project($userParameters)
{
$project_name = element("project_name", $userParameters, "");
$location = element("location", $userParameters, "");
$consultant_name = element("consultant_name", $userParameters, "");
$contractor_name = element("contractor_name", $userParameters, "");
$responsible_salesman = element("responsible_salesman", $userParameters, "");
$e_date = element("e_date", $userParameters, "");
$cn = element("cn", $userParameters, "");
$project_g_view = element("project_g_view", $userParameters, "");
$project_area = element("project_area", $userParameters, "");
$project_quantity = element("project_quantity", $userParameters, "");
$project_type = element("project_type", $userParameters, '0');
$project_size = element("project_size", $userParameters, "");
$project_diameters = element("project_diameters", $userParameters, "");
$average_diameter = element("average_diameter", $userParameters, "");
$wastage_rate = element("wastage_rate", $userParameters, "");
$shop_drawings_difficulty = element("shop_drawings_difficulty", $userParameters, "");
$shop_drawings_productivity = element("shop_drawings_productivity \t", $userParameters, "");
$fabrications_difficulty = element("fabrications_difficulty", $userParameters, "");
$fabrications_productivity = element("fabrications_productivity", $userParameters, "");
$tech_office_status = element("tech_office_status", $userParameters, "");
$technical_recommentation = element("technical_recommentation", $userParameters, '0');
$from = element("from", $userParameters, "");
$to = element("to", $userParameters, "");
$u_id = $this->session->userdata('auth.user_id');
$updated = date("Y-m-d h:i:s");
$data = array('project_name' => $project_name, 'location' => $location, 'consultant_name' => $consultant_name, 'contractor_name' => $contractor_name, 'responsible_salesman' => $responsible_salesman, 'e_date' => $e_date, 'cn' => $cn, 'project_g_view' => $project_g_view, 'project_area' => $project_area, 'project_quantity' => $project_quantity, 'project_type' => $project_type, 'project_size' => $project_size, 'project_diameters' => $project_diameters, 'average_diameter' => $average_diameter, 'wastage_rate' => $wastage_rate, 'shop_drawings_difficulty' => $shop_drawings_difficulty, 'shop_drawings_productivity' => $shop_drawings_productivity, 'fabrications_difficulty' => $fabrications_difficulty, 'fabrications_productivity' => $fabrications_productivity, 'tech_office_status' => $tech_office_status, 'technical_recommentation' => $technical_recommentation, 'from' => $from, 'to' => $to, 'u_id' => $u_id, 'updated' => $updated);
$this->db->update('urf_estimation', $data);
}
示例3: up
public function up()
{
$this->load->helper('date');
$is_datetime = strtolower(Model::TIMESTAMP_FORMAT) == 'datetime';
foreach ($this->tables() as $name => $prop) {
$keys = [];
$is_auto_timestamp = element(self::FLAG_AUTOTIMESTAMP, $prop, true);
if ($schemas = element(self::DB_SCHEMAS, $prop, [])) {
if (true === $is_auto_timestamp) {
$this->_auto_timestamp = true;
$creator = ['type' => 'int', 'constraint' => 11, 'unsigned' => true, 'default' => null];
if ($is_datetime) {
$timestamp = ['type' => 'datetime', 'default' => '0000-00-00 00:00:00'];
} else {
$timestamp = ['type' => 'int', 'constraint' => 11, 'unsigned' => true, 'default' => 0];
}
$schemas[Model::CREATION_KEY . '_by'] = $creator;
$schemas[Model::CREATION_KEY . '_at'] = $timestamp;
$schemas[Model::MODIFICATION_KEY . '_by'] = $creator;
$schemas[Model::MODIFICATION_KEY . '_at'] = $timestamp;
}
if (false === element(self::FLAG_DESTRUCTIVE, $prop, false)) {
$schemas[Model::DELETION_KEY] = ['type' => 'tinyint', 'constraint' => 1, 'unsigned' => true, 'DEFAULT' => 0];
}
foreach ($schemas as $column => $schema) {
if (isset($schema['key'])) {
$keys[$column] = $schema['key'];
unset($schema['key']);
}
}
if (true === element(self::FLAG_OVERRIDE, $prop, true)) {
$this->dbforge->drop_table($name, true);
}
$this->dbforge->add_field($schemas);
if (!empty($keys)) {
foreach ($keys as $key => $value) {
$this->dbforge->add_key($key, $value);
}
}
if (false === element(self::FLAG_ALTERTABLE, $prop, false)) {
if ($this->dbforge->create_table($name, true, ['engine' => 'InnoDB'])) {
log_message('info', 'Migration successfully create table ' . $name);
} else {
log_message('error', 'Migration failed to create table ' . $name);
}
}
}
if ($data = element(self::DB_DATA, $prop, [])) {
if (true === $is_auto_timestamp) {
$now = $is_datetime ? date('Y-m-d H:i:s') : time();
for ($d = 0; $d < count($data); $d++) {
$data[$d] += [Model::CREATION_KEY . '_by' => null, Model::CREATION_KEY . '_at' => $now, Model::MODIFICATION_KEY . '_by' => null, Model::MODIFICATION_KEY . '_at' => $now];
}
}
if ($this->db->insert_batch($name, $data)) {
log_message('info', 'Migration successfully insert data to table ' . $name);
}
}
}
}
示例4: render
public function render()
{
$app = $this->app;
$yaml = $this->yaml;
$datas = [];
foreach ($yaml['entry'] as $value) {
$custom = element('custom', $value);
$type = element('type', $value);
$label = element('label', $value);
$required = element('required', $value);
$help = element('help', $value);
$text = element('text', $value);
$attributes = element('attributes', $value);
$permission = element('permission', $value);
if ($permission && !$app['acl']->allow($permission)) {
continue;
}
$misc = ['type' => $type, 'label' => $label, 'required' => $required, 'text' => $text, 'help' => $help];
if ($custom) {
$class = element('class', $custom);
$action = element('action', $custom);
$param = ['label' => $label, 'help' => $help];
$form = call_user_func([$class, $action], $app, $param);
} else {
$form = $this->build($app, $misc, $attributes);
}
$datas[] = $form;
}
return $app['twig']->render('grid/entry/entry.html', ['datas' => $datas]);
}
示例5: index
/**
* 전체 메인 페이지입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_main_index';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$where = array('brd_search' => 1);
$board_id = $this->Board_model->get_board_list($where);
$board_list = array();
if ($board_id && is_array($board_id)) {
foreach ($board_id as $key => $val) {
$board_list[] = $this->board->item_all(element('brd_id', $val));
}
}
$view['view']['board_list'] = $board_list;
$view['view']['canonical'] = site_url();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 레이아웃을 정의합니다
*/
$page_title = $this->cbconfig->item('site_meta_title_main');
$meta_description = $this->cbconfig->item('site_meta_description_main');
$meta_keywords = $this->cbconfig->item('site_meta_keywords_main');
$meta_author = $this->cbconfig->item('site_meta_author_main');
$page_name = $this->cbconfig->item('site_page_name_main');
$layoutconfig = array('path' => 'main', 'layout' => 'layout', 'skin' => 'main', 'layout_dir' => $this->cbconfig->item('layout_main'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_main'), 'use_sidebar' => $this->cbconfig->item('sidebar_main'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_main'), 'skin_dir' => $this->cbconfig->item('skin_main'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_main'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
$view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
示例6: product_search
/**
* Produces JSON results for autocomplete form of prduct name entry
* Used on both the member side (fancy search) and admin side (find products to add to a members order)
*
**/
public function product_search($query = null)
{
//get the searce term and some other parameters that might have come with this query
if ($query == null) {
$query = $this->input->get('term');
}
//get other parameters and set some defaults
$params = $this->input->get();
if (element('return_seasons', $params) == null) {
$params['return_seasons'] = 'yes';
}
$this->load->model('products_model');
$search_params = array('p_name' => $query, 'p_status' => 'Active', 'include_supplier' => true, 'extended_detail' => true);
$products = $this->products_model->get_products($search_params);
// do some tidying for ajax before you send it back
$product_view = 'products/partial_product_item';
foreach ($products as $key => $p) {
if ($params['return_seasons'] == 'yes') {
$products[$key]['seasons'] = $this->products_model->get_product_allowances($p['p_id']);
}
if ($params['return_html'] == 'yes') {
$p_data = array('p' => $p, 'category' => array('cat_slug' => 'all'));
$products[$key]['item_html'] = $this->load->view($product_view, $p_data, TRUE);
}
}
$this->json = $products;
}
示例7: saveStudents
function saveStudents($arrPost)
{
$this->load->helper('array');
$studentsId = element('studentsid', $arrPost, NULL);
unset($arrPost['studentsid']);
if ($studentsId == null)
{
$this->db->insert('students', $arrPost);
log_message('debug', '>>>$sql: '.$this->db->last_query());
}
else
{
$sql = 'UPDATE sisrama.students
SET
regno = ?
,name = ?
,class=?
,parent = ?
,address = ?
,city = ?
,phone = ?
,birthdate=?
,birthplace=?
WHERE students.id = ?';
$arrPost['studentsid']=$studentsId;
$this->db->query($sql,$arrPost);
log_message('debug', '>>>$sql: '.$this->db->last_query());
}
}
示例8: index
/**
* 버전정보 페이지입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cbversion_index';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
Requests::register_autoloader();
$headers = array('Accept' => 'application/json');
$postdata = array('requesturl' => current_full_url(), 'package' => CB_PACKAGE, 'version' => CB_VERSION);
$request = Requests::post(config_item('ciboard_check_latest_version'), $headers, $postdata);
$view['view']['latest_versions'] = json_decode($request->body, true);
if (strtolower(CB_PACKAGE) === 'premium') {
$view['view']['latest_version_name'] = $view['view']['latest_versions']['premium_version'];
$view['view']['latest_download_url'] = $view['view']['latest_versions']['premium_downloadurl'];
} else {
$view['view']['latest_version_name'] = $view['view']['latest_versions']['basic_version'];
$view['view']['latest_download_url'] = $view['view']['latest_versions']['basic_downloadurl'];
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
示例9: update_category
/**
* 更新商品分类
*/
public function update_category($category_id, $category)
{
$location = trim(element('location', $category));
$category_name = trim(element('category_name', $category));
// 判断
if (!$category_name) {
return array('error_code' => '10010', 'error' => '商品分类名称不能为空!');
}
// 判断
$this->db->where('category_id !=', $category_id)->where('category_name', $category_name);
$count = $this->db->where('status', 1)->count_all_results("category");
if ($count > 0) {
return array('error_code' => '10011', 'error' => '商品分类名称已经存在!');
}
// 整理数据
$data = array('location' => intval($location), 'category_name' => $category_name);
// 更新数据
$res = $this->db->where('category_id', $category_id)->update('category', $data);
if ($res === false) {
return array('error_code' => '10012', 'error' => '修改商品分类失败!');
}
// 写日志
$this->load_model('logs_model')->add_content("修改商品分类: [{$category_name}]");
return array('message' => '修改商品分类成功!');
}
示例10: index_post
public function index_post()
{
$this->load->database();
$this->load->helper('array');
try {
$data = array('test_name' => $this->post('test_name'), 'test_heading' => $this->post('test_heading'), 'test_short_name' => $this->post('test_short_code'), 'group_id' => $this->post('test_group'), 'test_amount' => $this->post('test_charge'), 'test_remark' => $this->post('test_remark'), 'flag_id' => $this->post('flag_id'), 'method_id' => $this->post('method_id'), 'sample_id' => $this->post('sample_id'), 'instrument_id' => $this->post('instrument_id'), 'testIsOutsourced' => $this->post('testIsOutsourced'), 'testIsOutsourcedLab' => $this->post('testIsOutsourcedLab'), 'is_deleted' => 0);
$productDetails = $this->post('productDetails');
$this->db->where('test_name', element('test_name', $data));
$query = $this->db->get('test_master');
$count = $query->num_rows();
if ($count === 0) {
$this->db->insert('test_master', $data);
if ($this->db->affected_rows() > 0) {
$totalCount = $this->db->insert_id();
// get last inserted record Id
for ($i = 0; $i < count($productDetails); $i++) {
$user = array('test_id' => $totalCount, 'test_details' => $productDetails[$i]['parameters'], 'test_min_ref' => $productDetails[$i]['refbelow'], 'test_max_ref' => $productDetails[$i]['refabove'], 'patient_min_age' => $productDetails[$i]['agebelow'], 'patient_max_age' => $productDetails[$i]['ageabove'], 'patient_gender' => $productDetails[$i]['gender'], 'test_exam_type' => $productDetails[$i]['examination'], 'test_unit' => $productDetails[$i]['unit'], 'test_display_order' => $productDetails[$i]['order'], 'test_ref_range' => $productDetails[$i]['normalrange'], 'is_deleted' => 0);
$this->db->insert('test_detail_master', $user);
}
if ($this->db->affected_rows() > 0) {
$this->response(array("data" => array("status" => 201, "id" => element('test_name', $data), "message" => "Test and Test Details added succefully")));
} else {
$this->response(array("data" => array("status" => 301, "message" => "This test details allready exists.", "query" => $this->db->last_query())));
}
} else {
$this->response(array("data" => array("status" => 301, "message" => "Something went wrong please contact admin.", "query" => $this->db->last_query())));
}
} else {
$this->response(array("data" => array("status" => 301, "message" => "This test allready exists.", "query" => $this->db->last_query())));
}
} catch (Exception $e) {
$this->response(array("data" => array("message" => "Some error occured. Please contact admin.")));
}
}
示例11: get
public function get($key = null, $default = null)
{
if (!$key) {
return $this->all();
}
return element($key, $this->data, $default);
}
示例12: update_order
public function update_order($order_id, $invoice_id)
{
$session = $this->login();
if ($session) {
$result = $this->get_address($session, $invoice_id);
if (isset($result['shipping_address'])) {
$shipping = $result['shipping_address'];
$ship_to_name = $shipping['firstname'];
if (!empty($shipping['middlename'])) {
$ship_to_name .= ' ' . $shipping['middlename'];
}
if (!empty($shipping['lastname'])) {
$ship_to_name .= ' ' . $shipping['lastname'];
}
$ship_to_street = $shipping['street'];
$ship_to_street = str_replace(array("\n", '<br/>'), ' ', $ship_to_street);
$ship_to_street2 = '';
$ship_to_city = $shipping['city'];
$ship_to_state = $shipping['region'];
$ship_to_zip = element('postcode', $shipping, '');
$ship_to_country = $this->CI->mixture_model->get_country_name_in_english_by_code(strtoupper($shipping['country_id']));
$contact_phone_number = element('telephone', $shipping, '');
$shipping_address = $ship_to_name . ' ' . $ship_to_street . ' ' . $ship_to_city . ' ' . $ship_to_state . ' ' . $ship_to_country;
if ($order_id) {
$data = array('name' => $ship_to_name, 'shipping_address' => $shipping_address, 'address_line_1' => $ship_to_street, 'address_line_2' => $ship_to_street2, 'town_city' => $ship_to_city, 'state_province' => $ship_to_state, 'zip_code' => $ship_to_zip, 'country' => $ship_to_country, 'contact_phone_number' => $contact_phone_number);
$this->CI->order_model->update_order_information($order_id, $data);
}
}
}
}
示例13: get_ds
public function get_ds()
{
$this->db->select('SQL_CALC_FOUND_ROWS _currencies.rid as rid, _currencies.code as code,
_currencies.currency_name as currency_name,
_currencies.left_word as left_word,
_currencies.right_word as right_word,
DATE_FORMAT(_currencies.modifyDT, \'%d.%m.%Y\') as modifyDT,
_currencies.owner_users_rid,
_currencies.descr as descr, _currencies.archive', False);
$this->db->from('_currencies');
if ($searchRule = element('like', $this->ci->get_session('searchrule'), null)) {
$this->db->like($searchRule);
}
if ($searchRule = element('where', $this->ci->get_session('searchrule'), null)) {
$this->db->where($searchRule);
}
if ($searchRule = element('having', $this->ci->get_session('searchrule'), null)) {
$this->db->having($searchRule);
}
if ($sort = $this->ci->get_session('sort')) {
$this->db->orderby($sort['c'], $sort['r']);
}
$this->db->limit($this->ci->config->item('crm_grid_limit'), element('p', $this->ci->a_uri_assoc, null));
$query = $this->db_get('_currencies');
return $query->num_rows() ? $query->result() : array();
}
示例14: update_focus
/**
* 更新关注
*/
function update_focus($focus_id, $focus)
{
$sort = trim(element('sort', $focus));
$name = trim(element('name', $focus));
$score = trim(element('score', $focus));
$icon = trim(element('icon', $focus));
$url = trim(element('url', $focus));
// 判断
if (!$name) {
return array('error_code' => '10010', 'error' => '关注名称不能为空!');
}
// 判断
$this->db->where('focus_id !=', $focus_id)->where('name', $name);
$count = $this->db->where('status', 1)->count_all_results("focus");
if ($count > 0) {
return array('error_code' => '10011', 'error' => '关注名称已经存在!');
}
// 整理数据
$data = array('sort' => intval($sort), 'name' => $name, 'score' => $score, 'icon' => $icon, 'url' => $url);
// 更新数据
$res = $this->db->where('focus_id', $focus_id)->update('focus', $data);
if ($res === false) {
return array('error_code' => '10012', 'error' => '修改关注失败!');
}
// 写日志
$this->load_model('logs_model')->add_content("修改关注: [{$focus_name}]");
return array('message' => '修改关注成功!');
}
示例15: index
public function index()
{
$providers = array();
// Look for all oauth and oauth2 strategies
foreach (array('oauth', 'oauth2') as $strategy) {
if ($libraries = glob($this->module_details['path'] . '/' . $strategy . '/libraries/providers/*.php')) {
// Build an array of what is available
foreach ($libraries as $provider) {
$name = strtolower(basename($provider, '.php'));
$providers[$name] = array('strategy' => $strategy, 'human' => $this->providers[$name]['human'], 'default_scope' => element('default_scope', $this->providers[$name], NULL));
}
}
}
// Existing credentials, display id/key/secret/etc.
$all_credentials = $this->credential_m->get_all();
foreach ($all_credentials as $provider_credential) {
// Why do you have a credential for a missing provider? Weird
if (empty($providers[$provider_credential->provider])) {
continue;
}
$providers[$provider_credential->provider]['credentials'] = $provider_credential;
}
unset($all_credentials, $provider_credentials);
// Sort by provider. If oauth 1 and 2, it will use 2
ksort($providers);
$this->template->build('admin/index', array('providers' => $providers));
}