/** * Constructor * * @param string $caption Caption * @param string $name "name" attribute * @param string $value Initial text * @param string $rows Number of rows (facultative) * @param string $cols Number of cols (facultative) * @param string $width iframe width (facultative) * @param string $height iframe height (facultative) * @param array $options Toolbar Options (facultative) * OR * @param array $options Editor Options */ function __construct() { if (func_num_args()) { // if there is/are one or more arguments... $numargs = func_num_args(); // number of arguments $args_list = func_get_args(); // is an array of arguments if (!empty($args_list[$numargs - 1]) && is_array($args_list[$numargs - 1])) { // if the last argument is an array... $options = $args_list[$numargs - 1]; // ... it is an array of options foreach ($options as $key => $val) { // it sets the options if (method_exists($this, 'set' . Ucfirst($key))) { $this->{'set' . Ucfirst($key)}($val); } else { $this->{$key} = $val; } } } if ($numargs >= 2) { $this->caption = $args_list[0]; $this->name = $args_list[1]; $this->value = $numargs >= 3 ? $args_list[2] : ""; $this->rows = $numargs >= 4 ? $args_list[3] : $rows; $this->cols = $numargs >= 5 ? $args_list[4] : $cols; $this->XoopsFormTextArea($this->caption, $this->name, $this->value, $this->rows, $this->cols); } } }
public function beforeSave() { $this->images = str_replace(Helper::rootImg('content'), '', $this->images); $this->taxonomy = $this->_taxonomy; $this->name = Ucfirst($this->name); return true; }
public function beforeSave() { if ($this->parent != '' and $this->parent != 0) { $parent = $this->model()->resetScope()->findByPk((int) $this->parent); if ($this->slug == '') { $this->slug = $parent->slug . '-' . $this->name; } else { if ($this->isNewRecord) { $this->slug = $parent->slug . '-' . $this->slug; } else { $model = $this->model()->resetScope()->findByPk((int) $this->term_id); if ($model->slug != $this->slug) { $this->slug = $parent->slug . '-' . $this->slug; } } } } else { if ($this->slug == '') { $this->slug = $this->name; } } $this->images = str_replace(Helper::rootImg('content'), '', $this->images); $this->taxonomy = $this->_taxonomy; $this->name = Ucfirst($this->name); return parent::beforeSave(); }
/** * Get all roles of user * * @return array * * @author HAU DAI */ public function getRoleOptions() { $result = array(); $user_roles = Yii::app()->db->createCommand('SELECT name FROM ' . SITE_ID . '_authitem')->queryAll(); foreach ($user_roles as $user_role) { $result[$user_role['name']] = Ucfirst($user_role['name']); } return $result; // Yii::import('XUser.models.AdminUserGroup'); // return AdminUserGroup::model()->findAll("status = true"); }
public function add_edit_page($edit_id = "") { if (is_logged_in()) { $edit_id = isset($_POST['edit_id']) ? $_POST['edit_id'] : $edit_id; $this->form_validation->set_rules($this->_page_validation_rules); if ($this->form_validation->run()) { $form = $this->input->post(); // print_r($form);exit; // print_r($form);exit; if (isset($form['is_active'])) { $form['is_active'] = $form['is_active']; } else { $form['is_active'] = "0"; } $ins_data = array(); //print $filename;exit; $ins_data['name'] = Ucfirst($form['name']); $ins_data['dynamic_fields'] = $form['dynamic_fields']; $ins_data['is_active'] = $form['is_active']; if (empty($edit_id)) { $update_data = $this->page_model->insert("page", $ins_data); // $this->service_message->set_flash_message('record_insert_success'); } else { $update_data = $this->page_model->update("page", $ins_data, array("id" => $edit_id)); // $this->service_message->set_flash_message('record_update_success'); } redirect("page"); } if ($edit_id) { $edit_data = $this->page_model->get_page_data("page", array("id" => $edit_id)); if (!isset($edit_data[0])) { //$this->service_message->set_flash_message('record_not_found_error'); redirect("page"); } $this->data['title'] = "EDIT PAGE"; $this->data['crumb'] = "Edit"; $this->data['form_data'] = (array) $edit_data[0]; } else { if ($this->input->post()) { $this->data['form_data'] = $_POST; $this->data['title'] = "ADD PAGE"; $this->data['crumb'] = "Add"; $this->data['form_data']['id'] = $edit_id != '' ? $edit_id : ''; } else { $this->data['title'] = "ADD PAGE"; $this->data['crumb'] = "Add"; $this->data['form_data'] = array("name" => "", "is_active" => "", "dynamic_fields" => ""); } } $this->layout->view('page/add'); } else { redirect("login"); } }
public function tree($model, $listModel, $relational, $type = 'checkbox', $selectParent = true) { self::startWidget(Ucfirst($listModel)); $cat = $listModel::model()->findAll(array("order" => "name ASC")); $data = CHtml::listData($cat, 'term_id', function ($cat) { return array('parentid' => $cat->parent != 0 ? $cat->parent : '', 'text' => $cat->name); }); Yii::import("ext.AIOTree.*"); $this->Widget('AIOTree', array('model' => $model->{$relational}, 'attribute' => 'term_id', 'relation' => true, 'classname' => $listModel, 'data' => $data, 'type' => $type, 'selectParent' => $selectParent, 'header' => '', 'controlStyle' => 'margin-bottom:10px;', 'controlDivider' => ' - ', 'controlLabel' => array('collapse' => ' Collapse '), 'liHtmlOptions' => array('style' => 'margin:-2px 2px 0px 0px;'))); self::endWidget(); }
/** * Constructor * * @param array $configs Editor Options * @param binary $checkCompatible true - return false on failure */ function XoopsFormWysiwygTextArea($configs, $checkCompatible = false) { if (!empty($configs)) { foreach ($configs as $key => $val) { if (method_exists($this, 'set' . Ucfirst($key))) { $this->{'set' . Ucfirst($key)}($val); } else { $this->{$key} = $val; } } } if ($checkCompatible && !$this->isCompatible()) { return false; } }
public function email($to, $subject, $msg) { $email = $to; $pathang = pathang::GetInstance('pathang'); $api_key = $pathang->MAILGUN->API_KEY; $domain = $pathang->MAILGUN->DOMAIN_NAME; $from = $pathang->MAILGUN->ADMIN_EMAIL; $title = Ucfirst(pathang::getInstance('pathang')->META->TITLE); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, 'api:' . $api_key); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_URL, 'https://api.mailgun.net/v2/' . $domain . '/messages'); curl_setopt($ch, CURLOPT_POSTFIELDS, array('from' => $title . '<' . $from . '>', 'to' => $email, 'subject' => $subject, 'html' => $msg)); $result = curl_exec($ch); curl_close($ch); return $result; }
/** * The access Checking function * * @return bool */ function accessCheck() { $this->manage_access(); //if The requested controller in a public domain so give access permission no need to go further if ($this->isPublicRequest()) { return null; } //If we do not have to handle login then its better check this now!! if ($this->_loginUrl != "" && !$this->CI->session->userdata($this->CI->config->item('login_session_key', 'ez_rbac'))) { //user not logged in and you wished to handle it your self. Here you go redirect($this->_loginUrl); } $controller_methods = get_class_methods($this->_controller_name); $method = $this->CI->router->fetch_method(); //Called method does not exist! if (!in_array($method, $controller_methods)) { return null; } //Get custom access map defined in controller if (in_array('access_map', $controller_methods)) { $this->_custom_access_map = $this->CI->access_map(); } $this->CI->load->library('accessmap', array("controller" => $this->_controller)); //Check if the request is ajax or not $this->_isAjaxCall = $this->CI->input->get('ajax') || $this->CI->input->is_ajax_request(); $access_map = $this->CI->accessmap->get_access_map(); if (!in_array($method, $access_map)) { //The method is not in default acess map if (!isset($this->_custom_access_map[$method])) { //The method is not defined in custom access map if ($this->CI->config->item('default_access', 'ez_rbac')) { return TRUE; //Default access for action is set to true } $this->restrict_access(); } $method = $this->_custom_access_map[$method]; } $method = "can" . Ucfirst($method); if (!$this->CI->accessmap->{$method}()) { //We do not have the access permission! $this->restrict_access(); } }
echo base_url(); ?> user/renew_subscription/<?php echo $id; ?> " method="post"> <input type="hidden" name="pay_method" value="<?php echo $plan_detail[0]['payment_method']; ?> " > <div class="form-group"> <label class="col-md-4 control-label">Current Plan: </label> <div class="col-md-8"> <?php echo Ucfirst($plan_detail[0]['plan_name']); ?> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Chooe Other Plan: </label> <div class="col-md-8"> <?php $cp = $plan_detail[0]['plan_id']; foreach ($plans as $key => $value) { $np = $value['id']; $price = $value['plan_amount']; $type = $value['plan_type']; ?> <label class="pull-left">
function mailcontact() { $this->_NoTemplate(); $error = null; $html = null; $concat = null; foreach ($_GET as $key => $data) { if ($data == "" or @$_SESSION['conf']['mailer'][$key] == true) { $error = __("- El campos marcados no puede estar vacios", false); } if (!(@$_SESSION['conf']['concat_mailer'][$key] == true)) { $keyn = Ucfirst($key); $html .= "\n<b>{$keyn}</b>:<br/>\n\n {$data}<br/>\n\n "; } if (@$_SESSION['conf']['concat_mailer'][0] == $key) { $keyn = Ucfirst($key); $datax = "<table>"; foreach ($_SESSION['conf']['concat_mailer'] as $keyv => $valuev) { $datax .= "<tr>"; // echo "$keyv === 0<br/>"; if ($keyv != "0") { echo "exito"; $d = @$_POST[$keyv]; echo $keyv . '>>'; $datax .= "<td>{$d}</td>"; } $datax .= "</tr>"; } $datax .= "</table>"; // echo $datax.'<<<'; $html .= "\n<b>{$keyn}</b>:<br/>\n\n {$datax}<br/>\n\n "; } } if ($error == null) { $msg = __("Mensaje enviado", false); if (@$_SESSION['subject_particular'] == "") { $_SESSION['subject_particular'] = __("Formulario de Contacto", false); } basics::mail_html_utf8($this->mail_store, $_SESSION['subject_particular'], $html, $this->mail_store, 'Floreria Rosabel'); } else { $msg = $error; } echo @$html; echo "\n <script>\n alert('{$msg}');\n </script>\n "; $_SESSION['subject_particular'] = null; }
public function add_edit_employee($edit_id = "") { $user_id = $this->session->userdata('admin_data')['id']; $role = $this->session->userdata('admin_data')['role']; if ($role == '2') { $user_id = $this->session->userdata('admin_data')['id']; } else { $user_id = '8'; } if (isset($_POST['user_id'])) { $this->session->set_userdata('client_id', $_POST['user_id']); } else { $this->session->set_userdata('client_id', $user_id); } $this->data['get_menu'] = $this->employee_model->get_menu_client("users", array("role" => 2)); //print_r($this->data['get_menu']);exit; if (isset($_POST['user_id']) && $edit_id == "") { $this->form_validation->set_rules('user_id', 'Client', 'required|callback_max_limit_unique_check'); } if (isset($_POST['emp_id'])) { $this->form_validation->set_rules('emp_id', 'Employee ID', 'required|min_length[3]|max_length[6]|callback_employee_id_unique_check[' . $edit_id . ']'); } if ($role == 2 && $edit_id == "") { $this->form_validation->set_rules('employee_name', 'Name', 'required|callback_max_limit_unique_check'); } else { $this->form_validation->set_rules('employee_name', 'Name', 'trim|required'); } if (is_logged_in()) { $edit_id = isset($_POST['edit_id']) ? $_POST['edit_id'] : $edit_id; $this->form_validation->set_rules($this->_employee_validation_rules); if ($this->form_validation->run()) { $form = $this->input->post(); if (isset($form['is_active'])) { $form['is_active'] = $form['is_active']; } else { $form['is_active'] = "0"; } $ins_data = array(); $ins_data['employee_name'] = Ucfirst($form['employee_name']); $ins_data['employee_email'] = $form['employee_email']; $ins_data['is_active'] = $form['is_active']; if ($_POST['user_id'] == "") { $ins_data['created_user'] = $user_id; } else { $ins_data['created_user'] = $form['user_id']; $ins_data['updated_user'] = $this->session->userdata('admin_data')['id']; } $ins_data['created_date'] = date("Y-m-d H:i:s"); $ins_data['emp_id'] = $form['emp_id']; //$ins_data['video_file'] = $filename; //$this->header_model->update('cub_search_nav_bar',$ins_data); if (empty($edit_id)) { $social_data = $this->employee_model->insert("employee", $ins_data); // $this->service_message->set_flash_message('record_insert_success'); } else { echo $social_data = $this->employee_model->update("employee", $ins_data, array("id" => $edit_id)); //$this->service_message->set_flash_message('record_update_success'); } if ($role == 1) { $this->session->unset_userdata("clientid"); $this->session->set_userdata("clientid", $form['user_id']); redirect("employee"); } else { redirect("employee"); } } if ($edit_id) { $edit_data = $this->employee_model->get_slideimage_detail("employee", array("id" => $edit_id)); if (!isset($edit_data[0])) { // $this->service_message->set_flash_message('record_not_found_error'); redirect("employee"); } $this->data['title'] = "EDIT EMPLOYEE"; $this->data['crumb'] = "Edit"; $this->data['form_data'] = (array) $edit_data[0]; //$this->data['form_data']['slide_image'] = $this->data['form_data']['video_file']; } else { if ($this->input->post()) { $this->data['form_data'] = $_POST; $this->data['title'] = "ADD EMPLOYEE"; $this->data['crumb'] = "Add"; $this->data['form_data']['id'] = $edit_id != '' ? $edit_id : ''; } else { $this->data['title'] = "ADD EMPLOYEE"; $this->data['crumb'] = "Add"; $this->data['form_data'] = array("employee_name" => "", "employee_email" => '', "is_active" => "", "emp_id" => ""); } } $this->layout->view('employee/add'); } else { redirect("login"); } }
function combine_product($option, $fm_mod, &$fm_variants) { // global $fm_variants; global $fm; #Save the original $fm data $fm_mod_o = $fm_mod; #Take the first chunck of options $cur_option = array_splice($option, 0, 1); #Get option type (size, colour) $option_type = key($cur_option); #Run through the current array foreach (current($cur_option) as $option_line) { $fm_mod = $fm_mod_o; $fm_mod['stockQuantity'] = $option['stockQuantity'] >= $fm_mod['stockQuantity'] ? $option_line['stockQuantity'] : $fm_mod['stockQuantity']; $fm_mod['availability'] = $fm_mod['availability'] == 'out of stock' ? 'out of stock' : $option_line['availability']; $fm_mod['add_title'] .= ($fm_mod['add_title'] ? " - " : "") . $option_line['add_title']; $fm_mod['price'] += $option_line['price']; #If the option scope is size or colour, we store them to insert into feed col. if ($option_type == 'size' || $option_type == 'colour') { $fm_mod[$option_type] = $option_line['add_title']; #Size, colour } if ($option_type == 'size' && strlen($option_line['add_title']) < 2) { $fm_mod['add_sku'] .= ($fm_mod['add_sku'] ? "-" : "") . "Size" . $option_line['add_title']; } else { if ($option_type == 'colour') { $colorNames = explode(" ", trim($option_line['add_title'])); $productColour = ''; foreach ($colorNames as $colorName) { $productColour .= Ucfirst(strtolower($colorName)); } $fm_mod['add_sku'] .= ($fm_mod['add_sku'] ? "-" : "") . $productColour; } else { $fm_mod['add_sku'] .= ($fm_mod['add_sku'] ? "-" : "") . $option_line['add_sku']; } } if (count($option) > 0) { #If there is another option, need to go through and stick to this option object. combine_product($option, $fm_mod); } else { #If there is no options, we store the option snake. $fm_variants[] = $fm_mod; } } return; }
protected function action_stats_key_field() { $g = new xml_gen(); $s = new morg_stats($this->dbh); $this->head('Statistics - Missing Key Field: ' . Ucfirst($this->field), './?action=stats'); $this->generate_file_view($s->missing_key_field_data($this->field)); $this->foot(); }
$string .= '<tr><Th> Error </th><Td>' . $resError . '</td></tr>'; $string .= '<tr><Th> Description </th><Td>' . $descp . '</td></tr>'; $string .= '<tr><Th> Test Api </th><Td>'; $string .= '<form action="' . $serverurl . trim($url) . '" method="' . strtoupper(trim($method)) . '" id="f_' . $counter . '" enctype="multipart/form-data"><table>'; $string .= '<input type="hidden" name="url" value="' . $serverurl . trim($url) . '" >'; $string .= '<input type="hidden" name="method" value="' . strtoupper(trim($method)) . '" >'; foreach ($params as $row) { if (strtolower($row[1]) == 'file') { $inputField = '<input type="file" name="' . $row[0] . '" value="' . $row[3] . '" >'; } else { $inputField = '<input type="text" name="' . $row[0] . '" value="' . $row[3] . '" >'; } if (strtolower($row[0]) == 'tag') { $inputField = '<input type="text" readonly style="background: rgba(153, 153, 153, 0.42);" name="' . $row[0] . '" value="' . $row[3] . '" >'; } $string .= '<tr><th>' . Ucfirst($row[0]) . '</th><Td>' . $inputField . '</td></tr>'; } $string .= ''; $url = $serverurl . trim($url); $string .= '<tr><td colspan="2"><a onClick="FormSubmitData(\'' . $url . '\',' . $counter . ')" class="myButton">Test</a></td></tr>'; $string .= '<tr><td colspan="2"><div id="response_testapi_' . $counter . '"></div> </td></tr>'; $string .= '</table></form>'; $string .= '</td></tr>'; //"#response_testapi_"+id $string .= '</table></section>'; $counter++; $i++; } $string .= '</div></body></html>'; if (file_exists($file_name)) { unlink($file_name);
<?php require __DIR__ . '/../Library/bootstrap.php'; $uri = $_SERVER['REQUEST_URI']; $uriArr = explode('?', $uri); $path = $uriArr[0]; $path = trim($path, '/'); $arr = explode('/', $path); if ($arr[0] == 'resources') { $className = empty($arr[1]) ? false : Ucfirst(strtolower($arr[1])); header('location: /resources?class=' . $className); die; } else { $className = empty($arr[0]) ? false : Ucfirst(strtolower($arr[0])); if (empty($className)) { echo "默认路由不存在"; die; } $func = str_replace('.json', '', $arr[1]); $className = "Application\\Controller\\" . $className; $class = new $className(); // $method = Router::getRequestMethod(); $result = call_user_func_array(array($class, $func), $_REQUEST); echo json_encode($result); } class Router { public static function getRequestMethod() { $method = $_SERVER['REQUEST_METHOD']; if (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
/** * Generates the head html and return the results as a string * * @access public * @return string */ function fetchHead(&$document) { // get line endings $lnEnd = $document->_getLineEnd(); $tab = $document->_getTab(); $tagEnd = ' />'; $strHtml = ''; switch ($_REQUEST['Itemid']) { case '1': // index // index case '55': // รางน้ำฝน //case '56': // Home // รางน้ำฝน //case '56': // Home case '56': // ลูกหมุนระบาย // ลูกหมุนระบาย case '57': // ปล่องระบายควัน // ปล่องระบายควัน case '59': // ซิงค์ // ซิงค์ case '58': // เตาแก๊ส สังกะสี // เตาแก๊ส สังกะสี case '60': // รับสั่งทำเครื่องใช้ สังกะสี สแตนเลส //case '260': // gallery $strHtml .= $tab . '<title>' . htmlspecialchars($document->getTitle()) . '</title>' . $lnEnd; break; default: $sitename = str_replace('www.', '', strtolower($_SERVER['SERVER_NAME'])); $strHtml .= $tab . '<title>' . htmlspecialchars($document->getTitle()) . ' « ' . htmlspecialchars(Ucfirst($sitename)) . '</title>' . $lnEnd; break; } // Generate base tag (need to happen first) $base = $document->getBase(); if (!empty($base)) { $strHtml .= $tab . '<base href="' . $document->getBase() . '" />' . $lnEnd; } // Generate META tags (needs to happen as early as possible in the head) foreach ($document->_metaTags as $type => $tag) { foreach ($tag as $name => $content) { if ($type == 'http-equiv') { $strHtml .= $tab . '<meta http-equiv="' . $name . '" content="' . $content . '"' . $tagEnd . $lnEnd; } elseif ($type == 'standard') { $strHtml .= $tab . '<meta name="' . $name . '" content="' . str_replace('"', "'", $content) . '"' . $tagEnd . $lnEnd; } } } $strHtml .= $tab . '<meta name="description" content="' . $document->getDescription() . '" />' . $lnEnd; //$strHtml .= $tab.'<meta name="generator" content="'.$document->getGenerator().'" />'.$lnEnd; //$strHtml .= $tab.'<meta name="title" content="'.htmlspecialchars($document->getTitle()).'" />'.$lnEnd; //$strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd; // print_r($document->getHeadData()); //print_r($_REQUEST); // if ($_SERVER['REQUEST_URI'] == '/') { // $strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd; // } else { // $sitename = str_replace('www.', '', strtolower($_SERVER['SERVER_NAME'])); // $strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).' « '.htmlspecialchars(Ucfirst($sitename)).'</title>'.$lnEnd; // } // if ($sitename == strtolower($document->getTitle())) { // $strHtml .= $tab.'<title>'.htmlspecialchars(ucfirst($sitename)).'</title>'.$lnEnd; // } else { // $strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).' « '.htmlspecialchars(Ucfirst($sitename)).'</title>'.$lnEnd; // } // Generate link declarations foreach ($document->_links as $link) { $strHtml .= $tab . $link . $tagEnd . $lnEnd; } // Generate stylesheet links foreach ($document->_styleSheets as $strSrc => $strAttr) { $strHtml .= $tab . '<link rel="stylesheet" href="' . $strSrc . '" type="' . $strAttr['mime'] . '"'; if (!is_null($strAttr['media'])) { $strHtml .= ' media="' . $strAttr['media'] . '" '; } if ($temp = JArrayHelper::toString($strAttr['attribs'])) { $strHtml .= ' ' . $temp; } $strHtml .= $tagEnd . $lnEnd; } // Generate stylesheet declarations foreach ($document->_style as $type => $content) { $strHtml .= $tab . '<style type="' . $type . '">' . $lnEnd; // This is for full XHTML support. if ($document->_mime == 'text/html') { $strHtml .= $tab . $tab . '<!--' . $lnEnd; } else { $strHtml .= $tab . $tab . '<![CDATA[' . $lnEnd; } $strHtml .= $content . $lnEnd; // See above note if ($document->_mime == 'text/html') { $strHtml .= $tab . $tab . '-->' . $lnEnd; } else { $strHtml .= $tab . $tab . ']]>' . $lnEnd; } $strHtml .= $tab . '</style>' . $lnEnd; } // Generate script file links foreach ($document->_scripts as $strSrc => $strType) { $strHtml .= $tab . '<script type="' . $strType . '" src="' . $strSrc . '"></script>' . $lnEnd; } // Generate script declarations foreach ($document->_script as $type => $content) { $strHtml .= $tab . '<script type="' . $type . '">' . $lnEnd; // This is for full XHTML support. if ($document->_mime != 'text/html') { $strHtml .= $tab . $tab . '<![CDATA[' . $lnEnd; } $strHtml .= $content . $lnEnd; // See above note if ($document->_mime != 'text/html') { $strHtml .= $tab . $tab . '// ]]>' . $lnEnd; } $strHtml .= $tab . '</script>' . $lnEnd; } foreach ($document->_custom as $custom) { $strHtml .= $tab . $custom . $lnEnd; } return $strHtml; }
public function add_edit_inspection($edit_id = "") { //print_r($_POST);exit; $user_id = $this->session->userdata('admin_data')['id']; $role = $this->session->userdata('admin_data')['role']; if ($role == '2') { $user_id = $this->session->userdata('admin_data')['id']; } else { $user_id = '8'; } //print_r($_FILES);exit; $this->data['get_menu'] = $this->inspection_model->get_menu_inspection("users", array("role" => 2)); //print_r($this->data['get_menu']);exit; if (isset($_POST['user_id'])) { $this->form_validation->set_rules('user_id', 'Client', 'required'); } if (is_logged_in()) { $edit_id = isset($_POST['edit_id']) ? $_POST['edit_id'] : $edit_id; if (empty($_FILES['pdf_file']['name']) && empty($_POST['slide_image'])) { $this->form_validation->set_rules('pdf_file', 'File', 'required'); } $this->form_validation->set_rules($this->_inspection_validation_rules); if ($this->form_validation->run()) { $form = $this->input->post(); if (!empty($_FILES['pdf_file']['tmp_name'])) { $upload_data = $this->do_upload(); $filename = isset($upload_data['pdf_file']['file_name']) ? $upload_data['pdf_file']['file_name'] : ""; } else { $filename = isset($_POST['slide_image']) ? $_POST['slide_image'] : ""; } //print $filename;exit; if (isset($form['is_display'])) { $form['is_display'] = $form['is_display']; } else { $form['is_display'] = "0"; } if (isset($form['visible_to_all'])) { $form['visible_to_all'] = $form['visible_to_all']; } else { $form['visible_to_all'] = "0"; } $ins_data = array(); $ins_data['title'] = Ucfirst($form['title']); $ins_data['is_display'] = $form['is_display']; if ($_POST['user_id'] == "") { $ins_data['created_user'] = $user_id; } else { $ins_data['created_user'] = $form['user_id']; $ins_data['updated_user'] = $this->session->userdata('admin_data')['id']; $ins_data['visible_to_all'] = $form['visible_to_all']; } $ins_data['created_date'] = date("Y-m-d"); $ins_data['pdf_file'] = $filename; if (empty($edit_id)) { $social_data = $this->inspection_model->insert("inspection_reports", $ins_data); // $this->service_message->set_flash_message('record_insert_success'); } else { echo $social_data = $this->inspection_model->update("inspection_reports", $ins_data, array("id" => $edit_id)); //$this->service_message->set_flash_message('record_update_success'); } redirect("inspection"); } if ($edit_id) { $edit_data = $this->inspection_model->get_slideimage_detail("inspection_reports", array("id" => $edit_id)); if (!isset($edit_data[0])) { //$this->service_message->set_flash_message('record_not_found_error'); redirect("inspection"); } $this->data['title'] = "EDIT INSPECTION"; $this->data['crumb'] = "Edit"; $this->data['form_data'] = (array) $edit_data[0]; $this->data['form_data']['slide_image'] = $this->data['form_data']['pdf_file']; } else { if ($this->input->post()) { $this->data['form_data'] = $_POST; $this->data['title'] = "ADD INSPECTION"; $this->data['crumb'] = "Add"; $this->data['form_data']['id'] = $edit_id != '' ? $edit_id : ''; } else { $this->data['title'] = "ADD INSPECTION"; $this->data['crumb'] = "Add"; $this->data['form_data'] = array("title" => "", "is_display" => "", "slide_image" => "", "pdf_file" => "", "user_id" => "", "visible_to_all" => ""); } } $this->data['img_url'] = $this->layout->get_img_dir(); $this->layout->view('inspection/add'); } else { redirect("login"); } }
public function add_webinars($edit_id = "") { $user_id = $this->session->userdata('admin_data')['id']; $role = $this->session->userdata('admin_data')['role']; if ($role == '2') { $user_id = $this->session->userdata('admin_data')['id']; } else { $user_id = '8'; } $this->data['get_menu'] = $this->webinars_model->get_menu_webinars("users", array("role" => 2)); //print_r($this->data['get_menu']);exit; if (isset($_POST['user_id'])) { $this->form_validation->set_rules('user_id', 'Client', 'required'); } if (is_logged_in()) { $edit_id = isset($_POST['edit_id']) ? $_POST['edit_id'] : $edit_id; $this->form_validation->set_rules($this->_webinars_validation_rules); if ($this->form_validation->run()) { $form = $this->input->post(); /*if(!empty($_FILES['video_file']['tmp_name'])){ $upload_data = $this->do_upload(); $filename = (isset($upload_data['video_file']['file_name']))?$upload_data['video_file']['file_name']:""; }else{ $filename = (isset($_POST['slide_image']))?$_POST['slide_image']:""; } */ //print $filename;exit; if (isset($form['is_active'])) { $form['is_active'] = $form['is_active']; } else { $form['is_active'] = "0"; } if (isset($form['visible_to_all'])) { $form['visible_to_all'] = $form['visible_to_all']; } else { $form['visible_to_all'] = "0"; } $ins_data = array(); $ins_data['title'] = Ucfirst($form['title']); $ins_data['web_desc'] = $form['web_desc']; $ins_data['link'] = $form['link']; $ins_data['is_active'] = $form['is_active']; if ($_POST['user_id'] == "") { $ins_data['created_user'] = $user_id; } else { $ins_data['created_user'] = $form['user_id']; $ins_data['updated_user'] = $this->session->userdata('admin_data')['id']; $ins_data['visible_to_all'] = $form['visible_to_all']; } $ins_data['created_date'] = date("Y-m-d"); //$ins_data['video_file'] = $filename; //$this->header_model->update('cub_search_nav_bar',$ins_data); if (empty($edit_id)) { $social_data = $this->webinars_model->insert("webinars", $ins_data); // $this->service_message->set_flash_message('record_insert_success'); } else { echo $social_data = $this->webinars_model->update("webinars", $ins_data, array("id" => $edit_id)); //$this->service_message->set_flash_message('record_update_success'); } redirect("webinars"); } if ($edit_id) { $edit_data = $this->webinars_model->get_slideimage_detail("webinars", array("id" => $edit_id)); if (!isset($edit_data[0])) { $this->service_message->set_flash_message('record_not_found_error'); redirect("webinars"); } $this->data['title'] = "EDIT WEBINARS"; $this->data['crumb'] = "Edit"; $this->data['form_data'] = (array) $edit_data[0]; //$this->data['form_data']['slide_image'] = $this->data['form_data']['video_file']; } else { if ($this->input->post()) { $this->data['form_data'] = $_POST; $this->data['title'] = "ADD WEBINARS"; $this->data['crumb'] = "Add"; $this->data['form_data']['id'] = $edit_id != '' ? $edit_id : ''; } else { $this->data['title'] = "ADD WEBINARS"; $this->data['crumb'] = "Add"; $this->data['form_data'] = array("title" => "", "web_desc" => '', "link" => '', "is_active" => "", "slide_image" => "", "video_file" => "", "user_id" => "", "visible_to_all" => ""); } } $this->layout->view('webinars/add'); } else { redirect("login"); } }