• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP to_int函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中to_int函数的典型用法代码示例。如果您正苦于以下问题:PHP to_int函数的具体用法?PHP to_int怎么用?PHP to_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了to_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_question_detail

 public function get_question_detail($question_id, $form_type_id)
 {
     $this->db->where('id', to_int($question_id));
     $this->db->where('form_type_id', to_int($form_type_id));
     $this->db->select('q.id as question_id, q.form_type_id, q.form_section_id, q.description, q.help_text, q.type, q.allowed_types, q.max_size, q.table, q.options, q.sort_order')->from('questions q');
     return $this->db->get()->row();
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:7,代码来源:Survey_model.php


示例2: _post_args

 protected function _post_args($key, $type = ARGS_TYPE_STRING, $default = '', $params = array())
 {
     $value = '';
     $post_default = '';
     $key_exist = array_key_exists($key, $_POST);
     $override = array_key_exists('override', $params) ? $params['override'] : FALSE;
     $entities_to_ascii = array_key_exists('entities_to_ascii', $params) ? $params['entities_to_ascii'] : FALSE;
     $gtzero = array_key_exists('gtzero', $params) ? $params['gtzero'] : TRUE;
     switch ($type) {
         case ARGS_TYPE_STRING:
             $post_default = $override ? $default : '';
             $value = $key_exist ? $this->input->post($key, TRUE) ? $this->input->post($key, TRUE) : $post_default : $default;
             if ($entities_to_ascii) {
                 $value = entities_to_ascii($value);
             }
             break;
         case ARGS_TYPE_INT:
             $default = validate_integer($default) ? to_int($default) : 0;
             $post_default = $override ? $default : 0;
             $value = $key_exist ? ($value = $this->input->post($key)) && gtzero_integer($value) ? to_int($value) : $post_default : $default;
             break;
         case ARGS_TYPE_TRUE_FALSE:
             $default = validate_integer($default) ? gtzero_integer($default) ? TRUE : FALSE : FALSE;
             $post_default = $override ? $default : FALSE;
             $value = $key_exist ? ($value = $this->input->post($key)) && ($gtzero && gtzero_integer($value) || !$gtzero && validate_integer($value)) ? TRUE : $post_default : $default;
             break;
         case ARGS_TYPE_ARRAY:
             $value = $key_exist ? ($value = $this->input->post($key)) && is_array($value) ? $value : array() : (is_array($default) ? $default : array());
             break;
         case ARGS_TYPE_DECIMAL:
             $default = gtzero_decimal($default) ? to_float($default) : 0;
             $post_default = $override ? $default : 0;
             $value = $key_exist ? ($value = $this->input->post($key)) && gtzero_decimal($value) ? to_float($value) : $post_default : $default;
             break;
         case ARGS_TYPE_DATE:
             $default = validate_date($default) ? $default : '';
             $post_default = $override ? $default : '';
             $value = $key_exist ? ($value = $this->input->post($key)) && validate_date($value) ? $value : $post_default : $default;
             break;
         case ARGS_TYPE_DATETIME:
             $default = validate_datetime($default) ? $default : '';
             $post_default = $override ? $default : '';
             $value = $key_exist ? ($value = $this->input->post($key)) && validate_date($value) ? $value : $post_default : $default;
             break;
         default:
             $post_default = $override ? $default : '';
             $value = $key_exist ? $this->input->post($key, TRUE) ? $this->input->post($key, TRUE) : $post_default : $default;
             break;
     }
     unset($post_default);
     return $value;
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:52,代码来源:MY_Controller.php


示例3: buildQuerySets

  /** Builds the query from the the key=> values either in the arg $arr
   *  (if it was implemented from a controller action), or
   * from it's own values (if it is implemented in a search model), or from
   * a post array if it is implemented from a controller.
   * @param array $arr
   * @return array keyed by
   *   'fieldname'=>['val'=>$val,'crit'=>$crit, {'param'=>$param}
   */
  public function buildQuerySets(Array $arr = []) {
    if ($this->matchObjs === null) {
      $this->matchObjs=PkMatch::matchFactory(static::getFullQueryDef());
    }
    //pkdebug("The generated 'matches' are", $this->matchObjs);
    $this->checkClearPost();
    if (empty($arr)) {
      if ($this instanceOf PkModel) {
        #To use Accessors/Mutators
        //$arr = $this->getAttributes();
        $arr = $this->getAccessorAttributes();
      }
    }
    if (empty($arr)) return [];
    $sets = [];
    $clear = false;
    if (array_key_exists('submit', $arr) && ($arr['submit'] == 'clear'))
        $clear = true;
    foreach ($arr as $key => $val) {
      #Does it end in '_crit'?
      $root = removeEndStr($key, '_crit');
      if ($root === false) continue;#Not a crit
      if ($val === null) continue;
      if (!$this->isValidCriterion($key)) continue;
      #We COULD get static::getBasenameQueryDef($root) now, and see if we have supplimental info
      $maxvalfield = $root . '_maxval'; #For 'BETWEEN'comparison
      $minvalfield = $root . '_minval'; #For 'BETWEEN'comparison
      $valfield = $root . '_val';
      $valval = null;
      #Getting Complicated. $valval can be a scalar for ordinary comparison
      #If doing an " IN " comparison, $valval is a JSON encoded array.
      #if doing a "BETWEEN" comparison, $valval is an actual array, ['max'=>$max,'min'=>$min]
      $rootMatch = keyVal($root, $this->matchObjs, new PkMatch);
      if (array_key_exists($maxvalfield, $arr)) {
          $valval['maxval'] = $arr[$maxvalfield];
          $rootMatch->maxval = $arr[$maxvalfield];
      }
      if (array_key_exists($minvalfield, $arr)) {
          $valval['minval'] = $arr[$minvalfield];
          $rootMatch->minval = $arr[$minvalfield];
      }
      if (is_array($valval)) { #At least one of min or max was set for BETWEEN
        $rootMatch->maxval=$valval['maxval'] = to_int(keyVal('maxval', $valval), PHP_INT_MAX);
        $rootMatch->minval=$valval['minval'] = to_int(keyVal('minval', $valval), -PHP_INT_MAX);
      }
      if (array_key_exists($valfield, $arr)) $valval = $arr[$valfield];
      if ($valval === null) continue;
      //if (!array_key_exists($valfield, $arr)) continue;
      $paramfield = $root . '_param';
      $arr[$paramfield] = keyVal($paramfield, $arr);

      #We have a criterion and value - build our array
      //$sets[$root] = ['crit' => $arr[$key], 'val' => $arr[$valfield], 'param' => $arr[$paramfield]];
       
      $sets[$root] = [];
      $rootMatch->crit=$sets[$root]['crit'] = $arr[$key];
      $rootMatch->val=$sets[$root]['val'] = $valval;
      $rootMatch->param=$sets[$root]['param'] = $arr[$paramfield];
      $sets[$root]['def'] = static::getFullQueryDef($root);
    }
    $this->querySets = $sets;
    //pkdebug("After QA, mathcObjs are:", $this->matchObjs);
    //foreach ($this->matchObjs as $ma) {
      //if ($ma->compfield == 'assetdebtratio') pkdebug("After buildQS, The MA is: ", $ma);
    //}
    return $sets;
  }
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:75,代码来源:BuildQueryTrait.php


示例4: deactivate

 public function deactivate($pkey, $method = "echo")
 {
     _has_user_access_permission(TRUE, array('admin', 'management_company'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $company_id = $this->current_user->group_id == GROUP_ADMIN ? 0 : $this->current_user->company_id;
     $user_id = isset($params[SYS_USER_ID]) && gtzero_integer($params[SYS_USER_ID]) ? to_int($params[SYS_USER_ID]) : 0;
     $code = isset($params['code']) && !empty($params['code']) ? $params['code'] : FALSE;
     $redirect_url = $this->_post_args('redirect_url', ARGS_TYPE_STRING, $this->agent->referrer());
     $user_info = $this->user_m->details($user_id);
     if (!$user_info || _has_company_group_access($this->current_user->group_id) && $user_info->company_id != $this->current_user->company_id || $this->current_user->user_id == $user_id) {
         $this->show_permission_denied_error($method);
     }
     $company_id = $user_info->company_id;
     $this->form_validation->set_rules('confirm', 'confirm', 'trim|required');
     $output = array('message' => "", 'status' => "");
     if ($this->form_validation->run() == TRUE) {
         /*if ($this->_valid_csrf_nonce() === FALSE || $user_id != $this->input->post('id'))
         		{
         			show_error('This form post did not pass our security checks.');
         		}*/
         $is_record_updated = $this->ion_auth->deactivate($user_id);
         if ($is_record_updated) {
             $output['message'] = sprintf('The user "%s" has been deactivated.', $user_info->full_name);
             $output['status'] = SUCCESS_MESSAGE;
             $output['user_id'] = $user_id;
             /*trigger_trip("user_activated", $user_info->company_id, array('user_id' => $user_id, 'updated_by' => $this->current_user->user_id));*/
         } else {
             $output['message'] = sprintf('Error occurred while trying to deactivated user "%s".', $user_info->full_name);
             $output['status'] = ERROR_MESSAGE;
         }
         $this->_output_request($output, $redirect_url);
     } else {
         if (validation_errors()) {
             $output['message'] = validation_errors();
             $output['status'] = ERROR_MESSAGE;
         }
     }
     $csrf = _get_csrf_nonce();
     $data = array('form_action' => site_url('users/deactivate/' . $pkey), 'cancel_url' => $redirect_url, 'page' => 'user/confirm', 'title' => 'Deactivate User', 'display_message' => sprintf('Are you sure you want to deactivate user "%s"?', $user_info->full_name), 'display_heading' => sprintf('Deactivate User', $user_info->full_name), 'submit_btn_text' => "Save Changes", 'hiddenvars' => array_merge($csrf, array('redirect_url' => $redirect_url)));
     if ($this->input->is_ajax_request()) {
         $html = $this->template->raw_view('pages/user/confirm_modal', $data, TRUE);
         if ($method == "ajax") {
             $output['html'] = $html;
             $this->_output_request($output, $redirect_url);
         } else {
             echo $html;
         }
     } else {
         if (!empty($output['status'])) {
             set_flash_data($output['status'], $output['message'], FALSE);
         }
         $this->template->load('default', $data);
     }
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:54,代码来源:Users.php


示例5: get_by_many

 public function get_by_many($params = array(), $return = 'RESULT')
 {
     $this->db->select('nt.*')->select("CONCAT(u.first_name,' ',u.last_name) AS created_by_name", FALSE)->from('notes nt')->join('users u', 'nt.created_by = u.id', 'LEFT')->where('nt.is_deleted', 0);
     if (array_key_exists('ref_id', $params)) {
         $this->db->where('nt.ref_id', to_int($params['ref_id']));
     }
     if (array_key_exists('note_type_id', $params)) {
         $this->db->where('nt.note_type_id', to_int($params['note_type_id']));
     }
     if (array_key_exists('note_id_not', $params) && !empty($params['note_id_not'])) {
         $this->db->where('nt.id !=', $params['note_id_not'], FALSE);
     }
     if ($return == 'RESULT') {
         return $this->db->get()->result();
     } elseif ($return == 'ROW') {
         $this->db->limit(1);
         return $this->db->get()->row();
     } elseif ($return == 'COUNT') {
         return $this->db->count_all_results();
     } else {
         return $this->db->get()->result();
     }
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:23,代码来源:Notes_model.php


示例6: get_question_by_many

 public function get_question_by_many($params = array(), $return = 'result')
 {
     $srv = sprintf("(SELECT\n\t`sf`.`id` AS `site_form_id`,`sf`.`site_id`, `q`.`id` AS `question_id`, `q`.`description` AS `question_desc`, `q`.`help_text`,`q`.`type` AS `question_type`, `q`.`allowed_types`, `q`.`max_size`, `q`.`options`\n\t, `q`.`table` AS `question_table`, `q`.`form_type_id`, `q`.`form_section_id`, `q`.`sort_order`\t\nFROM site_forms sf\n\tINNER JOIN questions q ON sf.form_type_id =q.form_type_id\nWHERE \n\tsf.site_id=%d\n\tAND sf.form_type_id=%d) AS srv", $params['site_id'], $params['form_type_id']);
     $this->db->select('srv.*')->select('IFNULL(sff.answer, \'\') AS answer', FALSE)->select('IFNULL(sff.notes, \'\') AS notes', FALSE)->from('site_forms')->join($srv, 'site_forms.id=srv.site_form_id AND site_forms.site_id=srv.site_id AND site_forms.form_type_id=srv.form_type_id', 'INNER')->join('site_form_feedback sff', 'srv.site_form_id=sff.site_form_id AND srv.site_id=sff.site_id AND srv.form_type_id=sff.form_type_id AND srv.question_id=sff.question_id', 'LEFT')->where('site_forms.site_id', to_int($params['site_id']))->where('site_forms.form_type_id', to_int($params['form_type_id']))->where('site_forms.id', to_int($params['site_form_id']));
     if (array_key_exists('question_id', $params) && $params['question_id']) {
         $this->db->where('srv.question_id', to_int($params['question_id']));
     }
     $this->db->order_by('srv.form_type_id', 'ASC');
     $this->db->order_by('srv.form_section_id', 'ASC');
     $this->db->order_by('srv.sort_order', 'ASC');
     return $return == 'row' ? $this->db->get()->row() : $this->db->get()->result();
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:12,代码来源:Site_model.php


示例7: get_user_profile

 public function get_user_profile($user_id)
 {
     if (($data = _get_cache($user_id, CACHE_KEY_USER_PROFILE)) && $data !== FALSE) {
         return $data;
     }
     $this->db->select('u.id AS user_id, u.username, u.email, u.first_name, u.last_name, u.avatar, u.phone, g.id as group_id, u.postcode')->select('g.name as group_name, g.description as group_description, u.gmt_offset')->select("CONCAT(u.first_name,' ', u.last_name) AS user_full_name", FALSE)->from('users u')->join('users_groups ug', 'u.id = ug.user_id', 'INNER')->join('groups g', 'ug.group_id = g.id', 'INNER')->where('u.id', to_int($user_id))->group_by('u.id');
     $query = $this->db->get();
     $user_info = $query->row();
     if ($user_info) {
         $user_info->user_id = to_int($user_info->user_id);
         $user_info->group_id = to_int($user_info->group_id);
         $user_info->gmt_offset = ci()->cfg->gmt_offset;
         $user_info->{'company_id'} = $this->user_company_by_user_id($user_info->user_id, $user_info->group_id);
         $user_info->{'client_ids'} = FALSE;
         if ($user_info->group_id == GROUP_CLIENT_USER) {
             $user_info->{'client_ids'} = $clients;
         }
     }
     _set_cache($user_id, $user_info, CACHE_KEY_USER_PROFILE);
     return $user_info;
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:21,代码来源:User_model.php


示例8: details

 public function details($product_id)
 {
     $this->db->select('p.*')->select("CONCAT(u.first_name,' ',u.last_name) AS created_by_name", FALSE)->from('manufacturers m')->join('users u', 'm.created_by = u.id', 'LEFT')->where('m.is_deleted', 0)->where('m.id', to_int($product_id));
     $row = $this->db->get()->row();
     return $row;
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:6,代码来源:Manufacturer_model.php


示例9: delete

 public function delete($pkey, $method = "echo")
 {
     _has_user_access_permission(TRUE, array('admin', 'location_manager', 'user_company'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $type_id = isset($params[SYS_CONTACT_TYPE_ID]) && gtzero_integer($params[SYS_CONTACT_TYPE_ID]) ? to_int($params[SYS_CONTACT_TYPE_ID]) : 0;
     $ref_id = isset($params[SYS_REF_ID]) && gtzero_integer($params[SYS_REF_ID]) ? to_int($params[SYS_REF_ID]) : 0;
     $contact_id = isset($params[SYS_CONTACT_ID]) && gtzero_integer($params[SYS_CONTACT_ID]) ? to_int($params[SYS_CONTACT_ID]) : 0;
     $redirect_url = $this->_post_args('redirect_url', ARGS_TYPE_STRING, $this->agent->referrer());
     $contact_info = $this->contact_m->details($contact_id, $ref_id, $type_id);
     if (!$contact_info) {
         $this->show_permission_denied_error($method);
     }
     $this->form_validation->set_rules('confirm', 'confirm', 'trim|required');
     $output = array('message' => "", 'status' => "");
     if ($this->form_validation->run() == TRUE) {
         $is_record_updated = $this->contact_m->delete($contact_id);
         if ($is_record_updated) {
             $output['message'] = sprintf('The contact "%s" has been deleted.', $contact_info->contact_name);
             $output['status'] = SUCCESS_MESSAGE;
             $output['contact_id'] = $contact_id;
         } else {
             $output['message'] = sprintf('Error occurred while trying to delete contact "%s".', $contact_info->contact_name);
             $output['status'] = ERROR_MESSAGE;
         }
         $this->_output_request($output, $redirect_url);
     } else {
         if (validation_errors()) {
             $output['message'] = validation_errors();
             $output['status'] = ERROR_MESSAGE;
         }
     }
     $doc_key = $this->_post_args('doc_key', ARGS_TYPE_STRING) ? $this->_post_args('doc_key', ARGS_TYPE_STRING) : keygen();
     $csrf = _get_csrf_nonce();
     $data = array('form_action' => site_url('contacts/delete/' . $pkey), 'cancel_url' => $redirect_url, 'page' => 'contacts/delete', 'title' => 'Contact "' . $contact_info->contact_name . '"', "display_message" => sprintf('Are you sure you want to delete contact "%s"?', $contact_info->contact_name), "display_heading" => sprintf('Delete contact', $contact_info->contact_name), "submit_btn_text" => "Save Changes", 'hiddenvars' => array_merge($csrf, array('redirect_url' => $redirect_url)), 'doc_key' => $doc_key);
     if ($this->input->is_ajax_request()) {
         $html = $this->template->raw_view('pages/contacts/delete_modal', $data, TRUE);
         if ($method == "ajax") {
             $output['html'] = $html;
             $this->_output_request($output, $redirect_url);
         } else {
             echo $html;
         }
     } else {
         if (!empty($output['status'])) {
             set_flash_data($output['status'], $output['message'], FALSE);
         }
         $this->template->load('default', $data);
     }
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:49,代码来源:Contacts.php


示例10: displayValue

 public static function displayValue($value = null) {
   if (!$value) return '';
   $value = to_int($value * 100);
   return "$value%";
 }
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:5,代码来源:PkExtensions.php


示例11: to_int

<?php

// implicitly weak mode code
function to_int(int &$x)
{
}
function to_float(float &$x)
{
}
function to_string(string &$x)
{
}
function to_bool(bool &$x)
{
}
$x = 1.0;
var_dump($x);
to_int($x);
// because $x is by-reference, the weak type hint converts it
var_dump($x);
to_float($x);
var_dump($x);
to_string($x);
var_dump($x);
to_bool($x);
var_dump($x);
开发者ID:badlamer,项目名称:hhvm,代码行数:26,代码来源:scalar_weak_reference.php


示例12: show_files

 public function show_files($pkey = '')
 {
     $document_type_id = 9;
     $ref_id = 0;
     $doc_ref = FALSE;
     $params = ($params = wdp_arr_decode($pkey)) && is_array($params) ? $params : array();
     if ($params) {
         $ref_id = array_key_exists(WDP_REF_ID, $params) && gtzero_integer($params[WDP_REF_ID]) ? to_int($params[WDP_REF_ID]) : 0;
         $document_type_id = array_key_exists(WDP_TYPE_ID, $params) && gtzero_integer($params[WDP_TYPE_ID]) ? to_int($params[WDP_TYPE_ID]) : 0;
     } else {
         $doc_secret_key = wdp_arr_decode($this->input->post('doc_secret_key'));
         if ($doc_secret_key) {
             $ref_id = isset($doc_secret_key[WDP_REF_ID]) ? $doc_secret_key[WDP_REF_ID] : FALSE;
             $doc_ref = isset($doc_secret_key[WDP_DOC_REF]) ? $doc_secret_key[WDP_DOC_REF] : FALSE;
             $document_type_id = isset($doc_secret_key[WDP_TYPE_ID]) ? $doc_secret_key[WDP_TYPE_ID] : 0;
         } else {
             $ref_id = $this->input->post('ref_id');
             $doc_ref = $this->input->post('doc_ref');
             $document_type_id = $this->input->post('document_type_id') ? $this->input->post('document_type_id') : 0;
         }
     }
     $files = $this->document_model->get_files(array('ref_id' => $ref_id, 'doc_ref' => $doc_ref, 'document_type_id' => $document_type_id));
     $this->template->raw_view('pages/docs/files', array('files' => $files, 'ref_id' => $ref_id));
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:24,代码来源:Documents.php


示例13: delete

 public function delete($client_id)
 {
     $this->db->where('id', to_int($client_id));
     return $this->db->update('clients', array('is_deleted' => 1));
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:5,代码来源:Client_model.php


示例14: intOrNull

/**
 * Useful for converting empty strings to null for inserting null to int
 * fields in DB
 * @param mixed $value
 * @return integer|null
 */
function intOrNull($value = null) {
  $int = to_int($value);
  if ($int !== false) return $int;
  return null;
}
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:11,代码来源:pklib.php


示例15: index

 public function index($pkey = '', $method = 'echo')
 {
     ensure_user_access(TRUE, array('admin', 'management_company'));
     $params = ($params = wdp_arr_decode($pkey)) && is_array($params) ? $params : array();
     $company_id = $this->current_user->group_id == 1 ? 0 : $this->current_user->company_id;
     $grid_column_type_id = isset($params[GRID_CTYPE]) && gtzero_integer($params[GRID_CTYPE]) ? to_int($params[GRID_CTYPE]) : 0;
     $redirect_url = $this->_post_args('redirect_url', ARGS_TYPE_STRING, $this->agent->referrer());
     $params = array('user_id' => $this->current_user->user_id, 'grid_column_type_id' => $grid_column_type_id);
     if (_check_company_user_access()) {
         $params['company_id'] = $company_id;
     }
     $grid_columns = $this->setting_m->grid_columns_by_many($params);
     if (!$grid_columns) {
         $this->show_permission_denied_error($method);
     }
     $this->form_validation->set_rules('grid_column_rows', '', '');
     $output = array('message' => "", 'status' => "");
     if ($this->form_validation->run() == TRUE) {
         $grid_column_rows = $this->_post_args('grid_column_rows', ARGS_TYPE_ARRAY);
         if ($this->current_user->group_id == 2) {
             $this->setting_m->delete_company_grid_columns($company_id, $grid_column_type_id);
             foreach ($grid_column_rows as $grid_column_id => $is_visible) {
                 $this->setting_m->add_company_grid_columns(array('company_id' => $company_id, 'grid_column_id' => $grid_column_id, 'grid_column_type_id' => $grid_column_type_id, 'visible' => to_int($is_visible)));
             }
             $this->setting_m->user_grid_columns_by_many($company_id, array('company_id' => $company_id, 'grid_column_type_id' => $grid_column_type_id), TRUE);
         } else {
             $this->setting_m->delete_user_grid_columns($this->current_user->user_id, $grid_column_type_id);
             foreach ($grid_column_rows as $grid_column_id => $is_visible) {
                 $this->setting_m->add_user_grid_columns(array('user_id' => $this->current_user->user_id, 'grid_column_id' => $grid_column_id, 'grid_column_type_id' => $grid_column_type_id, 'visible' => to_int($is_visible)));
             }
             $this->setting_m->user_grid_columns_by_many($company_id, array('user_id' => $this->current_user->user_id, 'grid_column_type_id' => $grid_column_type_id), TRUE);
         }
         $gparams = array('grid_column_type_id' => $grid_column_type_id, 'user_id' => $this->current_user->user_id);
         if (_check_company_user_access()) {
             $gparams['company_id'] = $this->current_user->company_id;
         }
         $grid_columns = $this->setting_m->user_grid_columns_by_many($this->current_user->company_id, $gparams);
         $output['message'] = 'Setting Saved';
         $output['status'] = SUCCESS_MESSAGE;
         $output['grid_columns'] = $grid_columns;
         //$output['redirect'] 	= $redirect_url;
         $this->_output_request($output, $redirect_url);
     } else {
         if (validation_errors()) {
             $output['message'] = validation_errors();
             $output['status'] = ERROR_MESSAGE;
         }
     }
     $details = $this->company_m->company_settings($company_id);
     $data = array('form_action' => site_url('settings/gcolumns/index/' . $pkey), 'cancel_url' => $redirect_url, 'page' => 'settings/my_grid_permission', 'title' => 'Grid Setting', 'submit_btn_text' => 'Save Changes', 'company_id' => $company_id, 'grid_columns' => $grid_columns->columns, 'js_files' => array('settings/gcolumns.js'), 'hiddenvars' => array('redirect_url' => $redirect_url));
     if ($this->input->is_ajax_request()) {
         $html = $this->template->raw_view('pages/settings/my_grid_permission_modal', $data, TRUE);
         if ($method == "ajax") {
             $output['html'] = $html;
             $this->_output_request($output, $redirect_url);
         } else {
             echo $html;
         }
     } else {
         $this->template->load('default', $data);
     }
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:62,代码来源:Gcolumns.php


示例16: get_company_by_client

 public function get_company_by_client($client_id)
 {
     $this->db->select('com.*')->from('companies com')->join('clients cl', 'com.id = cl.company_id', 'INNER')->where('cl.id', to_int($client_id));
     $query = $this->db->get();
     if ($query->num_rows() > 0) {
         return $query->row()->id;
     } else {
         return FALSE;
     }
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:10,代码来源:Company_model.php


示例17: download

 public function download($pkey, $method = "echo")
 {
     _has_user_access_permission(TRUE, array('admin'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $company_id = in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_STAFF, GROUP_ENGINEER)) ? $this->_post_args('company_id', ARGS_TYPE_INT, array_key_exists(SYS_COMPANY_ID, $params) && gtzero_integer($params[SYS_COMPANY_ID]) ? to_int($params[SYS_COMPANY_ID]) : 0) : $this->current_user->company_id;
     $site_id = isset($params[SYS_SITE_ID]) && gtzero_integer($params[SYS_SITE_ID]) ? to_int($params[SYS_SITE_ID]) : 0;
     $redirect_url = $this->_post_args('redirect_url', ARGS_TYPE_STRING, $this->agent->referrer());
     $site_statuses = array('' => '', 1 => 'OPEN', 2 => 'SUBMITTED', 3 => 'COMPLETED');
     $site_info = $this->site_m->details($site_id, $company_id);
     if (!$site_info || _has_company_group_access($this->current_user->group_id) && $site_info->company_id != $this->current_user->company_id) {
         $this->show_permission_denied_error($method);
     }
     $company_id = in_array($this->current_user->group_id, array(GROUP_ADMIN, GROUP_STAFF, GROUP_ENGINEER)) ? $this->_post_args('company_id', ARGS_TYPE_INT, $site_info->company_id) : $this->current_user->company_id;
     $doc_key = $this->_post_args('doc_key', ARGS_TYPE_STRING) ? $this->_post_args('doc_key', ARGS_TYPE_STRING) : keygen();
     $csrf = _get_csrf_nonce();
     $headings = array("SITE", "FORM", "DATE ADDED", "ADDED BY", "STATUS", "DATE SUBMITTED", "SUBMITTED BY", "DATE COMPLETED", "COMPLETED BY");
     $this->load->library('PHPExcel');
     $this->load->library('PHPExcel/IOFactory');
     // Create a new PHPExcel object
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getActiveSheet()->setTitle('List of Site Forms');
     $rowNumber = 1;
     $col = 'A';
     foreach ($headings as $heading) {
         $objPHPExcel->getActiveSheet()->setCellValue($col . $rowNumber, $heading);
         $col++;
     }
     // Loop through the result set
     $rowNumber = 2;
     foreach ($site_info->site_forms as $site_form) {
         $col = 'A';
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, $site_info->site_code);
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, $site_form->form_name);
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, _validate_date($site_form->added_on, 'Y-m-d H:i:s') ? local_time($site_form->added_on, 'M d, Y @ h:ia') : '');
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, $site_form->added_by_name);
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, $site_statuses[$site_form->status]);
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, _validate_date($site_form->submitted_on, 'Y-m-d H:i:s') ? local_time($site_form->submitted_on, 'M d, Y @ h:ia') : '');
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, $site_form->submitted_by_name);
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, _validate_date($site_form->completed_on, 'Y-m-d H:i:s') ? local_time($site_form->completed_on, 'M d, Y @ h:ia') : '');
         $objPHPExcel->getActiveSheet()->setCellValue($col++ . $rowNumber, $site_form->completed_by_name);
         $rowNumber++;
     }
     $objWriter = IOFactory::createWriter($objPHPExcel, 'Excel5');
     // We'll be outputting an excel file
     header('Content-type: application/vnd.ms-excel');
     // It will be called file.xls
     header('Content-Disposition: attachment; filename="' . date('Ymd') . '.xls"');
     // Write file to the browser
     $objWriter->save('php://output');
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:50,代码来源:Sites.php


示例18: randDateBetween

 public static function randDateBetween($date1, $date2 = null)
 {
     if (to_int($date1) && (is_null($date2) || to_int($date2))) {
         $sql = false;
         if (!$date2) {
             $date2 = time();
         }
     } else {
         if (is_string($date1) && (is_null($date2) || is_string($date2))) {
             $sql = true;
             $date1 = strtotime($date1);
             if (!$date2) {
                 $date2 = time();
             } else {
                 $date2 = strtotime($date2);
             }
         } else {
             try {
                 throw new \Exception("We don't know how to deal with the arguments");
             } catch (\Exception $e) {
                 die($e->getTraceAsString());
             }
         }
     }
     $min = min($date1, $date2) / 1000;
     $max = max($date1, $date2) / 1000;
     $rnd = 1000 * mt_rand($min, $max);
     if (!$sql) {
         return $rnd;
     }
     return date('Y-m-d H:i:s', $rnd);
 }
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:32,代码来源:PkTestGenerator.php


示例19: delete

 public function delete($pkey, $method = "echo")
 {
     _has_user_access_permission(TRUE, array('admin', 'management_company', 'user_company'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $company_id = $this->current_user->group_id == 1 ? $this->_post_args('company_id', ARGS_TYPE_INT, array_key_exists(SYS_COMPANY_ID, $params) && gtzero_integer($params[SYS_COMPANY_ID]) ? to_int($params[SYS_COMPANY_ID]) : 0) : $this->current_user->company_id;
     $client_id = isset($params[SYS_CLIENT_ID]) && gtzero_integer($params[SYS_CLIENT_ID]) ? (int) $params[SYS_CLIENT_ID] : 0;
     $redirect_url = $this->_post_args('redirect_url', ARGS_TYPE_STRING, $this->agent->referrer());
     $client_info = $this->client_m->details($client_id, $company_id);
     if (!$client_info || _has_company_group_access($this->current_user->group_id) && $client_info->company_id != $this->current_user->company_id) {
         $this->show_permission_denied_error($method);
     }
     $company_id = $this->current_user->group_id == 1 ? $this->_post_args('company_id', ARGS_TYPE_INT, $client_info->company_id) : $this->current_user->company_id;
     $this->form_validation->set_rules('confirm', 'confirm', 'trim|required');
     $output = array('message' => "", 'status' => "");
     if ($this->form_validation->run() == TRUE) {
         $is_record_updated = $this->client_m->delete($client_id);
         if ($is_record_updated) {
             $output['message'] = sprintf('The client "%s" has been deleted.', $client_info->full_name);
             $output['status'] = SUCCESS_MESSAGE;
             $output['client_id'] = $client_id;
             /*trigger_trip("client_deleted", $details->company_id, array('client_id' => $client_id, 'deleted_by' => $this->current_user->user_id));*/
         } else {
             $output['message'] = sprintf('Unable to delete client "%s". Please report the issue to %s', $client_info->full_name, $this->cfg->contact_email);
             $output['status'] = ERROR_MESSAGE;
         }
         $this->_output_request($output, $redirect_url);
     } else {
         if (validation_errors()) {
             $output['message'] = validation_errors();
             $output['status'] = ERROR_MESSAGE;
         }
     }
     $csrf = _get_csrf_nonce();
     $data = array('form_action' => site_url('clients/delete/' . $pkey), 'cancel_url' => $redirect_url, 'page' => 'clients/delete', 'title' => 'Delete Client', "display_message" => sprintf('Are you sure you want to delete client "%s"?', $client_info->full_name), "display_heading" => sprintf('Delete Client', $client_info->full_name), "submit_btn_text" => "Save Changes", 'hiddenvars' => array_merge($csrf, array('redirect_url' => $redirect_url, 'confirm' => 1)));
     if ($this->input->is_ajax_request()) {
         $html = $this->template->raw_view('pages/clients/delete_modal', $data, TRUE);
         if ($method == "ajax") {
             $output['html'] = $html;
             $this->_output_request($output, $redirect_url);
         } else {
             echo $html;
         }
     } else {
         if (!empty($output['status'])) {
             set_flash_data($output['status'], $output['message'], FALSE);
         }
         $this->template->load('default', $data);
     }
 }
开发者ID:dimplewraich,项目名称:finalproject,代码行数:49,代码来源:Clients.php


示例20: qdelete

 public function qdelete($pkey, $method = "echo")
 {
     _has_user_access_permission(TRUE, array('admin'));
     $params = ($params = unserialize_object($pkey)) && is_array($params) ? $params : array();
     $form_type_id = isset($params[SYS_FORM_TYPE_ID]) && gtzero_integer($params[SYS_FORM_TYPE_ID]) ? to_int($params[SYS_FORM_TYPE_ID]) : 0;
     $question_id = isset($params[SYS_QUESTION_ID]) && gtzero_integer($params[SYS_QUESTION_ID]) ? to_int($params[SYS_QUESTION_ID]) : 0;
     $redirect_url = $this->_post_args('redirect_url', ARGS_TYPE_STRING, $this->agent->referrer());
     $form_info = $this->survey_m->form_type_details($form_type_id);
     $question_info = $this->survey_m->get_question_detail($question_id, $form_type_id);
     if (!$form_info) {
         $this->show_permission_denied_error($method);
     }
     $this->form_validation->set_rules('confirm', 'confirm', 'trim|required');
     $output = array('message' => "", 'status' => "");
     if ($this->form_validation->run() == TRUE) {
         $is_record_updated = $this->survey_m->delete_question($question_id);
         if ($is_record_updated) {
             $output['message'] = sprintf('The question "%s" has been deleted.', $question_info->description);
             $output['status'] = SUCCESS_MESSAGE;
             $output['question_id'] = $question_id;
         } else {
             $output['message'] = sprintf('Unable to delete question "%s". Please report the issue to %s', $question_info->description, $this->cfg->contact_email);
             $output['status'] = ERROR_MESSAGE;
         }
         $this->_output_request($output, $redirect_url);
     } else {
         if (validation_errors()) {
             $output['message'] = validation_errors();
             $output['status'] = ERROR_MESSAGE;
         }
     }
     $csrf = _get_csrf_nonce();
     $data = array('form_action' => site_url('survey/qdelete/' . $pkey), 'cancel_url' => $redirect_url, 'page' => 'survey/delete', 'title' => 'Delete Question', "display_message" => sprintf('Are you sure you want to delete question "%s"?', $question_info->description), "display_heading" => sprintf('Delete Question', $question_info->description), "submit_b 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP to_json函数代码示例发布时间:2022-05-23
下一篇:
PHP to_html函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap