/**
  * 
  * Redirect all requests to module/action
  * 
  * @param string $module
  * @param string $action
  * @param string $type
  * @param string $num
  */
 public function index($module = 'site', $action = 'index', $type = null, $num = 1)
 {
     $this->usermodel->isLoggedIn($module, $action);
     $this->head_data['title'] = 'Главная страница';
     $this->content['box-title'] = 'Привет!';
     if ($module == 'site') {
         $this->content['body'] = 'Привет';
     } else {
         $module_data = modules::run($module . '/' . $action, $type, $num);
         $this->head_data['title'] = $module_data[1];
         $this->content['u_session'] = $this->session->userdata();
         $this->content['body'] = $module_data[0];
     }
     $this->loadTemplates();
 }
示例#2
0
 public function mid()
 {
     if ($this->module_alias) {
         $method = $this->uri->segment(4, 'index');
         echo modules::run($this->module_alias . '/' . $method);
     }
 }
示例#3
0
 function index()
 {
     // $enemigos= $this->load->module('enemigos');
     // $load['enemigos']= $enemigos->listar();
     $load['enemigos'] = modules::run('enemigos/enemigos/listar', 'Amigos');
     $this->load->view('saludo', $load);
 }
示例#4
0
 function __construct()
 {
     parent::__construct();
     $this->load->library('session');
     $this->load->helper('url');
     $user_id = $this->session->userdata('user_id');
     if (!$user_id) {
         redirect('sessions/login');
     }
     if (!isset(self::$is_loaded)) {
         self::$is_loaded = TRUE;
         $this->load->config('mcb_menu/mcb_menu');
         modules::run('mcb_menu/check_permission', $this->uri->uri_string(), $this->session->userdata('global_admin'));
         $this->load->database();
         $this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice', 'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app', 'mcb_invoice_amount', 'mcb_invoice_item', 'mcb_invoice_payment', 'mcb_numbers'));
         $this->load->model(array('mcb_modules/mdl_mcb_modules', 'mcb_data/mdl_mcb_data', 'mcb_data/mdl_mcb_userdata'));
         $this->mdl_mcb_modules->set_module_data();
         $this->mdl_mcb_data->set_session_data();
         $this->mdl_mcb_userdata->set_session_data($user_id);
         $this->mdl_mcb_modules->load_custom_languages();
         $this->load->language('mcb', $this->mdl_mcb_data->setting('default_language'));
         $this->load->model('fields/mdl_fields');
         $this->load->library(array('form_validation', 'redir'));
         $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
         if ($this->mdl_mcb_data->setting('enable_profiler')) {
             $this->output->enable_profiler();
         }
     }
 }
示例#5
0
    public function render($label_template = '{title}', $back_url = NULL)
    {
        if (empty($this->mItems)) {
            return '<p>No records are found.</p>';
        } else {
            $html = modules::run('adminlte/widget/box_open', 'Sort Order', 'primary');
            // Render form with alert message
            $html .= '<form action="' . current_full_url() . '" method="POST">';
            $html .= $this->CI->system_message->render();
            $html .= '<p>Drag and drop below items to sort them in ascending order:</p>';
            // Generate item list by CodeIgniter Template Parser
            $template = '<ul class="sortable list-group">
				{items}
				<li class="list-group-item">
					<strong>' . $label_template . '</strong>
					<input type="hidden" name="' . $this->mPostName . '[]" value="{id}" />
				</li>
				{/items}
			</ul>';
            $data = array('items' => $this->mItems);
            $html .= $this->CI->parser->parse_string($template, $data, TRUE);
            if ($back_url != NULL) {
                $html .= modules::run('adminlte/widget/btn', 'Back', $back_url, 'reply', 'bg-purple') . ' ';
            }
            $html .= modules::run('adminlte/widget/btn_submit', 'Save');
            $html .= '</form>';
            $html .= modules::run('adminlte/widget/box_close');
            return $html;
        }
    }
示例#6
0
 function _custom_save()
 {
     foreach ($this->mdl_mcb_modules->custom_modules as $module) {
         if ($module->module_enabled and isset($module->module_config['settings_save'])) {
             modules::run($module->module_config['settings_save']);
         }
     }
 }
示例#7
0
 public function blog_category()
 {
     $crud = $this->generate_crud('demo_blog_categories');
     $crud->columns('title');
     $this->mTitle .= 'Blog Categories';
     $this->mViewData['crud_note'] = modules::run('adminlte/widget/btn', 'Sort Order', 'demo/blog_category_sortable');
     $this->render_crud();
 }
示例#8
0
 function show_widgets()
 {
     foreach ($this->mdl_mcb_modules->custom_modules as $module) {
         if ($module->module_enabled and isset($module->module_config['dashboard_widget'])) {
             echo modules::run($module->module_config['dashboard_widget']);
         }
     }
 }
示例#9
0
文件: user.php 项目: jabouzi/jazz
 private function show($view, $user_data)
 {
     $this->load->helper('form');
     $view_data['user'] = $user_data;
     $view_data['status'] = array(0 => lang('user.status0'), 1 => lang('user.status1'));
     $view_data['permissions'] = modules::run('permission/get_permissions_dropdown');
     return $this->load->view($view . '.php', $view_data, true);
 }
示例#10
0
文件: auth.php 项目: rhendy7/juara
 function login()
 {
     $data['title'] = "Login";
     //validate form input
     $this->form_validation->set_rules('identity', 'Identity', 'required');
     $this->form_validation->set_rules('password', 'Password', 'required');
     if ($this->form_validation->run() == true) {
         //cek pertama login pengguna dengan loading M_user di tb_pengguna
         if ($this->ion_auth->cek_first($this->input->post('identity'), $this->input->post('password')) == TRUE) {
             //buat akun dengan email dan password ini
             //load M_user
             $this->load->model('M_user');
             $pengguna = $this->M_user->get_user_by_email($this->input->post('identity'));
             $username = $pengguna->username;
             $email = $pengguna->email;
             $password = $pengguna->password;
             $additional_data = array('pengguna_id' => $pengguna->pengguna_id);
             //kalo sudah ada pengguna_id di tb_auth_user
             //maka cukup update datanya saja....
             $auth_user = $this->M_user->get_user_by_pengguna_id_auth_user($pengguna->pengguna_id);
             if ($auth_user == TRUE) {
                 if ($auth_user->email != $pengguna->email) {
                     $this->ion_auth->update($auth_user->id, $data);
                 }
             } else {
                 $this->session->set_userdata('email', $pengguna->email);
                 //go to login pertama pengelola
                 modules::run('redirection');
             }
             //then form masukkan kordinat dilengkapi dengan nama profil sekolah.
         } else {
             //check to see if the user is logging in
             //check for "remember me"
             $remember = (bool) $this->input->post('remember');
             if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember)) {
                 //if the login is successful
                 //redirect them back to the home page
                 $this->session->set_flashdata('message', $this->ion_auth->messages());
                 modules::run('redirection/cek_group');
                 // redirect('admin', 'refresh');
             } else {
                 //if the login was un-successful
                 //redirect them back to the login page
                 $this->session->set_flashdata('message', $this->ion_auth->errors());
                 redirect('auth/login', 'refresh');
                 //use redirects instead of loading views for compatibility with MY_Controller libraries
             }
         }
     } else {
         //the user is not logging in so display the login page
         //set the flash data error message if there is one
         $data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message');
         $data['identity'] = array('name' => 'identity', 'id' => 'identity', 'type' => 'text', 'value' => $this->form_validation->set_value('identity'));
         $data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password');
         $this->template->set('title', 'Login Form');
         $this->template->load($this->_template . 'login', 'content/V_login', $data);
     }
 }
示例#11
0
 public function index()
 {
     if ($this->session->userdata('user_id') == '') {
         header('Location: ' . url('login'));
     } else {
         $content['content'] = $this->load->view('home', '', TRUE);
         echo modules::run('_main/render', $content);
     }
 }
示例#12
0
 public function empcontract()
 {
     $url = url();
     $content['header_tags'] = '<link rel="stylesheet" href="' . $url . 'visaappres/css/font-awesome.min.css">
     <link rel="stylesheet" href="' . $url . 'visaappres/css/bootstrap.min.css">
     <link rel="stylesheet" href="' . $url . 'visaappres/css/main.css">';
     $content['content'] = $this->load->view('empcontract', '', TRUE);
     echo modules::run('_main/render', $content);
 }
示例#13
0
 function index()
 {
     $seg1 = $this->uri->segment(3);
     $seg2 = $this->uri->segment(4) ? $this->uri->segment(4) : 'index';
     // $enemigos= $this->load->module('enemigos');
     // $load['enemigos']= $enemigos->listar();
     $load['enemigos'] = modules::run('$seg1/$seg1/$seg2');
     $this->load->view('saludo', $load);
 }
示例#14
0
 public function admincp_index()
 {
     modules::run('admincp/chk_perm', $this->session->userdata('ID_Module'), 'r', 0);
     $default_func = 'created';
     $default_sort = 'DESC';
     $data = array('module' => $this->module, 'module_name' => $this->session->userdata('Name_Module'), 'default_func' => $default_func, 'default_sort' => $default_sort);
     $this->template->write_view('content', 'index', $data);
     $this->template->render();
 }
示例#15
0
文件: home.php 项目: kelgwiin/tesis
	public function index()
	{
		modules::run('general/is_logged', base_url().'index.php/usuarios/iniciar-sesion');
		$data['main_content'] = $this->load->view('home_view','',TRUE);

		//Cargando la lista de menus del sidebar genérica (se puede puede personalizar, ver ejemplo
		//en el controlador de modules/utilities/utils.php) 
		$l = $this->utils->list_sidebar();
		$this->utils->template($l,'home/home_view','','','',
			'two_level');
	}
示例#16
0
文件: login.php 项目: rbatenb/Admin
 public function forgot_password()
 {
     $this->form_validation->set_rules('cms_username', 'Gebruikersnaam', 'required');
     $this->form_validation->set_rules('cms_password', 'Wachtwoord', 'required');
     if ($this->form_validation->run()) {
         $data = $this->forgot_password_model->fetch_details();
         if ($data != false) {
             modules::run('admin/send_email', $data['email'], $this->config->item('subject', 'forgot_password'), $this->config->item('body', 'forgot_password'));
         }
     }
     $this->load->view('forgot_password/index');
 }
示例#17
0
 public function index()
 {
     if ($this->session->userdata('user_id') == '') {
         header('Location: ' . url('home'));
     } else {
         $data = array();
         $data['userinfo'] = $this->master->get_userinfo();
         $data['meta']['title'] = 'Profile';
         $content['content'] = $this->load->view('profile', $data, TRUE);
         echo modules::run('_main/render', $content);
     }
 }
示例#18
0
文件: tasks.php 项目: manuelnice/fo
 function _assigned_notification($project, $task_name, $assigned_to)
 {
     $project_title = $this->user_profile->get_project_details($project, 'project_title');
     $added_by = $this->user_profile->get_user_details($this->tank_auth->get_user_id(), 'username');
     $data['project_title'] = $project_title;
     $data['added_by'] = $added_by;
     $data['task_name'] = $task_name;
     $params['recipient'] = $this->user_profile->get_user_details($assigned_to, 'email');
     $params['subject'] = '[ ' . $this->config->item('company_name') . ' ]' . ' New task requested by ' . $added_by;
     $params['message'] = $this->load->view('emails/assigned_notification', $data, TRUE);
     $params['attached_file'] = '';
     modules::run('fomailer/send_email', $params);
 }
示例#19
0
 function index()
 {
     $seg1 = $this->uri->segment(3);
     $seg2 = $this->uri->segment(4) ? $this->uri->segment(4) : 'index';
     //$modulo= $this->load->module($this->uri->segment(3));
     //$modulo= $this->load->module('usuarios','');
     //$modulo->index();
     echo modules::run('usuarios/admin/saludo');
     /*$this->load->view('admin/header',$this->datos);
     		// eval("\$modulo->"\$seg2"\()"\ ;");
     		// eval('$modulo->'.$seg2.'();');
     		$this->load->view('admin/foot',$this->datos);*/
 }
示例#20
0
 function print_other()
 {
     $this->load->helper('language');
     $this->load->helper('url');
     var_dump($this->lang->lang());
     var_dump($this->lang->languages);
     $view_data['module'] = 'apptest';
     $view_data['view_file'] = 'apptest';
     $this->load->module('mytest')->speak('Skander');
     echo modules::run('mytest/speak', 'Yo man');
     echo site_url() . $this->lang->switch_uri('en');
     echo '<br />';
     echo anchor('login', 'Login');
 }
示例#21
0
文件: l10n.php 项目: hoogle/ttt
 public function index()
 {
     $this->load->library('session');
     $lang_perm = $this->session->userdata('lang_perm');
     $userid = $this->session->userdata('user_id');
     $is_login = $userid ? 1 : 0;
     $data = array('userid' => $userid, 'is_login' => $is_login, 'lang_perm' => $is_login ? $lang_perm : NULL, 'use_lang' => $this->_browser_lang);
     $this->load->library("layout", "layout_main");
     if (!$is_login) {
         $this->layout->view("l10n/l10n/index", $data);
     } else {
         echo modules::run("l10n/lang/changes", $data);
     }
 }
示例#22
0
 public function get_category_products_sort_filtered()
 {
     modules::run('catalogue/catalogue_sort/index');
     modules::run('catalogue/types/index');
     if ($category_id = $this->variables->get_vars('category_id')) {
         $this->load->model('catalogue/mcatalogue_sort');
         $this->mcatalogue_sort->_init();
         $this->load->model('catalogue/mtypes');
         $this->mtypes->_init();
         $this->build_category_products_temptate_js();
         $this->load->model('catalogue/mproducts');
         $products_array = $this->mproducts->get_category_products_collection_sort_filtered($category_id);
         $this->build_category_products_template_blocks($products_array);
     }
 }
 public function render()
 {
     $_database = $this->get_menu_database();
     if ($_database->num_rows() > 0) {
         $menu = "";
         foreach ($_database->result() as $row) {
             switch ($row->menu_item_type) {
                 case 1:
                     $classActive = "";
                     if ($this->CI->uri->segment(1) == $row->url) {
                         $classActive = "active";
                     }
                     if ($row->need_authentication == 1) {
                         if ($this->CI->session->has_userdata("user_logged_in")) {
                             $menu .= "<li  class='menu {$classActive}'>\n\t\t\t\t\t                     \t    <a data-pjax class='' href='" . site_url() . "{$row->url}'>\n\t\t\t\t\t                                <i class='{$row->icon}'></i>\n\t\t\t\t\t                                <span>" . lang($row->menu_item_name) . "</span>\n\t\t\t\t\t                            </a>\n\t\t\t\t                        \t</li>";
                         }
                     } else {
                         if ($row->need_authentication == 0) {
                             $menu .= "<li  class='menu {$classActive}'>\n\t\t\t\t                     \t    <a data-pjax class='' href='" . site_url() . "{$row->url}'>\n\t\t\t\t                                <i class='{$row->icon}'></i>\n\t\t\t\t                                <span>" . lang($row->menu_item_name) . "</span>\n\t\t\t\t                            </a>\n\t\t\t                        \t</li>";
                         }
                     }
                     break;
                 case 2:
                     $classActive = "";
                     if ($this->CI->uri->segment(1) == $row->module) {
                         $classActive = "active";
                     }
                     if (!check_module_active($row->module)) {
                         log_message('info', 'MODULE SYSTEM: Call offline Module');
                         return show_error('Модуль не доступен');
                     }
                     if ($row->need_authentication == 1) {
                         if ($this->CI->session->has_userdata('user_logged_in')) {
                             $menu .= modules::run($row->module . '/generateMenu', $classActive);
                         }
                     } else {
                         if (!$this->CI->session->has_userdata('user_logged_in')) {
                             $menu .= modules::run($row->module . '/generateMenu', $classActive);
                         }
                     }
                     break;
             }
         }
         return $menu;
     } else {
         return NUll;
     }
 }
示例#24
0
 public function get_products()
 {
     $this->load->model('catalogue/mcategories');
     $per_cat = $this->mcategories->check_permission();
     $customer = $this->session->userdata('CUSTOMER');
     $customer_groups = array();
     $ch = false;
     $this->template->add_template('catalogue_template', array(), 'content_block');
     if ($per_cat['permission'] == 0) {
         modules::run('catalogue/products/get_category_products');
     } else {
         if ($per_cat['permission'] == 1) {
             if ($customer) {
                 modules::run('catalogue/products/get_category_products');
             } else {
                 $this->template->add_view_to_template('center_block', 'catalogue/products/permission_template', array());
             }
         } else {
             if ($per_cat['permission'] == 2) {
                 if ($customer) {
                     foreach ($customer['m_u_types'] as $id => $value) {
                         $customer_groups[] = $value;
                     }
                     $cat_groups = $this->mcategories->get_category_id_groups($per_cat['ID']);
                     foreach ($cat_groups as $ms) {
                         foreach ($ms as $key => $value) {
                             if (in_array($value, $customer_groups)) {
                                 modules::run('catalogue/products/get_category_products');
                                 $ch = false;
                                 break 2;
                             } else {
                                 $ch = true;
                             }
                         }
                     }
                     if ($ch == true) {
                         $this->template->add_view_to_template('center_block', 'catalogue/products/permission_template', array());
                     }
                 } else {
                     $this->template->add_view_to_template('center_block', 'catalogue/products/permission_template', array());
                 }
             }
         }
     }
 }
示例#25
0
 public function quote($quote_id)
 {
     if ($this->mailer_configured == TRUE) {
         if ($this->input->post('btn_send')) {
             $this->load->helper('phpmailer');
             $quote = modules::run('quotes/generate_pdf', $quote_id, FALSE);
             $from = $this->input->post('from_name') ? array($this->input->post('from_email'), $this->input->post('from_name')) : $this->input->post('from_email');
             $to = $this->input->post('to_email');
             $subject = $this->input->post('subject');
             $message = $this->input->post('body');
             $cc = $this->input->post('to_cc');
             $bcc = $this->input->post('to_bcc');
             if (phpmail_send($from, $to, $subject, $message, $quote, $cc, $bcc)) {
                 redirect('dashboard');
             } else {
                 redirect('mailer/quote/' . $quote_id);
             }
             $this->session->set_flashdata('alert_success', 'Email successfully sent');
             redirect('dashboard');
         }
         $this->load->model('invoices/mdl_templates');
         $this->load->model('quotes/mdl_quotes');
         $this->load->model('email_templates/mdl_email_templates');
         if ($email_template_id = $this->mdl_settings->setting('default_email_template')) {
             $email_template = $this->mdl_email_templates->where('email_template_id', $email_template_id)->get();
             if ($email_template->num_rows()) {
                 $this->layout->set('body', $email_template->row()->email_template_body);
             } else {
                 $this->layout->set('body', '');
             }
         } else {
             $this->layout->set('body', '');
         }
         $this->layout->set('quote', $this->mdl_quotes->where('fi_quotes.quote_id', $quote_id)->get()->row());
         $this->layout->set('quote_templates', $this->mdl_templates->get_quote_templates());
         $this->layout->buffer('content', 'mailer/quote');
         $this->layout->render();
     } else {
         $this->layout->buffer('content', 'mailer/not_configured');
         $this->layout->render();
     }
 }
示例#26
0
 public function __construct()
 {
     parent::__construct();
     //$a = get_class($this);
     $this->load->helper('url');
     $this->load->driver('plenty_parser');
     //validate login
     $user_id = $this->session->userdata('user_id');
     if (!$user_id) {
         redirect('sessions/login');
     }
     //this check is required to increase security in a multi hosting environment where different urls
     //point to different installations of MCBSB
     //the current base_url has to match the value stored in session
     $this->load->config('mcbsb');
     if ($this->config->item('validate_url')) {
         $authenticated_for_url = $this->session->userdata('authenticated_for_url');
         if ($authenticated_for_url != base_url()) {
             redirect('sessions/logout');
         }
     }
     if (!isset(self::$is_loaded)) {
         self::$is_loaded = TRUE;
         $this->load->config('mcb_menu/mcb_menu');
         $this->load->database();
         $this->load->helper(array('uri', 'mcb_currency', 'mcb_invoice', 'mcb_date', 'mcb_icon', 'mcb_custom', 'mcb_app', 'mcb_invoice_amount', 'mcb_invoice_item', 'mcb_invoice_payment', 'mcb_numbers'));
         $this->load->model(array('mcb_modules/mdl_mcb_modules', 'mcb_data/mdl_mcb_data', 'mcb_data/mdl_mcb_userdata'));
         modules::run('mcb_menu/check_permission', $this->uri->uri_string(), $this->session->userdata('global_admin'));
         $this->mdl_mcb_modules->set_module_data();
         $this->mdl_mcb_data->set_session_data();
         $this->mdl_mcb_userdata->set_session_data($user_id);
         $this->mdl_mcb_modules->load_custom_languages();
         $this->load->language('mcb', $this->mdl_mcb_data->setting('default_language'));
         $this->load->model('fields/mdl_fields');
         $this->load->library(array('form_validation', 'redir'));
         $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
         if ($this->mdl_mcb_data->setting('enable_profiler')) {
             $this->output->enable_profiler();
         }
     }
 }
示例#27
0
	public function index()
	{
		modules::run('general/is_logged', base_url().'index.php/usuarios/iniciar-sesion');

		$fecha_actual = date('Y-m-j H:i:s');

		$date = date('Y-m-d');
		$newdate = strtotime ( '+8 day' , strtotime ( $date ) ) ;
		$fecha_proxima = date ( 'Y-m-d 23:59:00' , $newdate );

		$eventos_recientes = $this->niveles->obtener_revisiones_recientes($fecha_actual,$fecha_proxima);

		$data_view['eventos_recientes']	= $eventos_recientes;
		$data_view['inicio']	= $fecha_actual;
		$data_view['fin']	= $fecha_proxima;


		$data_view['acuerdos'] =$this->general->get_result('acuerdo_nivel_servicio',array('DATE(fecha_final) >=' => date('Y-m-d') ));
		$data_view['acuerdos_violados']  = $this->niveles->obtener_acuerdos_violados(); // Todos los acuerdos
		$data_view['servicios'] = $this->general->get_table('servicio');

		$this->utils->template($this->list_sidebar_niveles(1),'niveles/main_niveles',$data_view,'Niveles de Servicio','','two_level');
	}
示例#28
0
	public function guardar_disponibilidad($data){
		
		 //$this->debug = true;
        $date = modules::run('Disponibilidad/dateLastMonth',0,1);

        //Recopilando nombre de los procesos que se encuentran asociados a los Servicios
        $nom_procesos = $this->nom_proc_historial();
        $data = array();
        
        //Obteniendo la data asociada a los procesos recopilados
        foreach ($nom_procesos as $nom) {
            unset($data_tmp);
            
           
            $data_tmp = $this->proc_hist_por_hora_mensual($date,$nom,3);
            if(isset($data_tmp) && $data_tmp !== false){
                $data[$nom] = $data_tmp;
            }
        }
        
        //numero de registros por comando
        $reg_por_com = $this->num_procesos();
        
        
        $resultados = array();
        foreach ($data as $key => &$val) {
            $val[2] *= $reg_por_com[$key]*60*24;//repeticiones * minutos * horas
            $resultados[$key] = $val;
        }
        
        $servicios_proc = $this->procesos_servicio();
        $sum_por_serv = array();
        
        foreach ($servicios_proc as $row) {
            if(isset($sum_por_serv[$row['servicio_id']]) ){
                for ($i=0; $i < 3; $i++) { 
                    //Se verifica que exista data de rendimiento
                    //para el proceso asociado al servicio
                    if(isset($resultados[$row['p']])){
                        $sum_por_serv[$row['servicio_id']][$i] += $resultados[$row['p']][$i];
                    }
                }
            }else{
                for ($i=0; $i < 3; $i++) {
                    if(isset($resultados[$row['p']])){
                        $sum_por_serv[$row['servicio_id']][$i] = $resultados[$row['p']][$i];
                    }else{
                        $sum_por_serv[$row['servicio_id']][$i] = 0;
                    }
                    
                }
            }
            
        }
        
       
		
		
		//Calculo Porcentaje de disponibilidad 
             $sql = "SELECT porcentaje_disponibilidad, horas_fiabilidad, horas_confiabilidad, horas_disponibilidad
                        FROM acuerdos_servicios 
                        WHERE  ".$whereAux.";";
                
                $q = $this->db->query($sql);
                $rs = array();
                if($q->num_rows() > 0)
                {
                    foreach ($q->result_array() as $row) 
                    {
                        $rs[] = array($row['porcentaje_disponibilidad'], $row['horas_fiabilidad'],  $row['horas_confiabilidad'], $row['horas_disponibilidad']);
						
                    }
                    $date=$hoursPerDayArray[$arrayIndex][0];
                    $date = substr($date, 0, -9);

                    $tmp_prom = $this->procesar_caso($rs,6,3);
                    
                    for ($i=0; $i < $num_params; $i++) { 
                        $acums[$i] += $tmp_prom[$i];
                        $counter++;
                    }


                    $byHour++;
                }
                
                $sql = "SELECT tiempo_online
                        FROM proceso_historial 
                        WHERE  ".$whereAux.";";
                
                $q = $this->db->query($sql);
                $rs = array();
                if($q->num_rows() > 0)
                {
                    foreach ($q->result_array() as $row) 
                    {
                    	//Se transforma a horas
                        $rs2[] = array($row['tiempo_online'] / 3600);
						
                    }
                    $date=$hoursPerDayArray[$arrayIndex][0];
                    $date = substr($date, 0, -9);

                    $tmp_prom = $this->procesar_caso($rs,6,3);
                    
                    for ($i=0; $i < $num_params; $i++) { 
                        $acums[$i] += $tmp_prom[$i];
                        $counter++;
                    }


                    $byHour++;
                }
                
				$sql = "SELECT tiempo_ejecucion_total, tiempo_inactividad, num_caidas
                        FROM servicio_historial 
                        WHERE  ".$whereAux.";";
                
                $q = $this->db->query($sql);
                $rs = array();
                if($q->num_rows() > 0)
                {
                    foreach ($q->result_array() as $row) 
                    {
                    	//Se transforma a horas
                        $rs3[] = array($row['tiempo_ejecucion_total'] / 3600);
						$rs3[] = array($row['tiempo_inactividad'] / 3600);
						$rs3[] = array($row['num_caidas']);
                    }
                    $date=$hoursPerDayArray[$arrayIndex][0];
                    $date = substr($date, 0, -9);

                    $tmp_prom = $this->procesar_caso($rs,6,3);
                    
                    for ($i=0; $i < $num_params; $i++) { 
                        $acums[$i] += $tmp_prom[$i];
                        $counter++;
                    }


                    $byHour++;
                }
				
				
              //Guardando resutaldos  
			$porcentaje_dispo=(($rs['horas_disponibilidad'] - $rs2['tiempo_online']) / $rs['horas_disponibilidad'] ) * 100;
			$fiabilidad = $rs['horas_disponibilidad'] / $rs3['num_caidas'];
			$confiabilidad = (($rs['horas_disponibilidad'] - $rs3['tiempo_inactividad']) / $rs3['num_caidas']);
			
		
		
		
		//Se guarda el calculo en disponibilidad
        $sql_update = "UPDATE disponibilidad
						SET borrado = 1
						WHERE YEAR(fecha) = YEAR(CURDATE()) AND MONTH(fecha) = MONTH(CURDATE())
						AND servicio_id = ? ";

        foreach ($data as $key => $row) {
            //Marcar como borrado el valor si ya estaba previamente calculado
        	$this->db->query($sql_update, array($key));

            $f = date('Y-m-d H:i:s',now());
            $info = array(
                'disponibilidad_id'=>$key,
                'servicio_id'=>$key,
                'servicio_historial_id'=>$key,
                'descripcion'=>$row[0],
                'tiempo_medio_fallos'=>$row[1],
                'calculo_disponibilidad'=>$porcentaje_dispo,
                'calculo_fiabilidad'=> $fiabilidad, //wired
                'calculo_confiabilidad'=> $confiabilidad
            );
            $this->db->insert('disponibilidad',$info);
        }
    }
示例#29
0
    ?>
/assets/frontend/img/seemore.png" /></a></div>
                <input type="hidden" id="offset" value="<?php 
    echo 3;
    ?>
" />
                <?php 
}
?>
             
          </div>
      </div>
    </div>
  </div>
  <?php 
echo modules::run('banner/banner/index');
?>
  
  </div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/da_DK/all.js#xfbml=1&appId=329684403786353";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<script>
jQuery(document).ready(function(){
	jQuery("#sugarshop_active").addClass('active');
示例#30
-2
 function runService($module, $state)
 {
     $CI =& get_instance();
     $CI->load->library('m_database');
     $w = array("option_key LIKE " => "service_" . $module . "_%", 'option_val' => '1');
     $d = $CI->m_database->fetchData('options', $w);
     $c = $CI->m_database->countData('options', $w);
     $x = "";
     foreach ($d as $r) {
         $san = str_replace("service_" . $module . "_", "", $r->option_key);
         $sname = 'service_' . $state;
         $x = modules::run('service/' . $module . '/' . $san . '/' . $sname);
     }
     return $x;
 }