Ejemplo n.º 1
0
    echo _l($link['name']);
    ?>
				</a>
			</li>
		<?php 
}
unset($menu_holder);
unset($menu_type);
unset($current_link);
unset($menu_allow_nesting);
?>
        <?php 
if (isset($show_quick_search) && $show_quick_search) {
    ?>
        <?php 
    if (module_security::getcred() && module_security::can_user(module_security::get_loggedin_id(), 'Show Quick Search') && $display_mode != 'mobile') {
        if (module_config::c('global_search_focus', 1) == 1) {
            module_form::set_default_field('ajax_search_text');
        }
        ?>
            <li>
                <div id="quick_search_box">
                    <div id="quick_search_placeholder"><div><?php 
        _e('Quick Search:');
        ?>
</div></div>
                    <input type="text" name="quick_search" id="ajax_search_text" size="10" value="">
                    <div id="ajax_search_result"></div>
                </div>
            </li>
         <?php 
Ejemplo n.º 2
0
 function save_file_comments($file_id)
 {
     if (isset($_REQUEST['new_comment_text']) && strlen($_REQUEST['new_comment_text'])) {
         $file_data = $this->get_file($file_id);
         $item_data = array("file_id" => $file_id, "create_user_id" => module_security::get_loggedin_id(), "comment" => $_REQUEST['new_comment_text']);
         update_insert("file_comment_id", "new", "file_comment", $item_data);
         $file_data['comment'] = $_REQUEST['new_comment_text'];
         // do we schedule an alert for this file upload?
         if (module_security::can_user(module_security::get_loggedin_id(), _FILE_COMMENT_ALERT_STRING)) {
             // the current user is one who receives file alerts.
             // so for now we don't schedule this alert.
             // hmm - this might not work with a team environment, we'll send alerts no matter what :)
         }
         $alert_users = module_user::get_users_by_permission(array('category' => _LABEL_USER_SPECIFIC, 'name' => _FILE_COMMENT_ALERT_STRING, 'module' => 'config', 'view' => 1));
         if (count($file_data['staff_ids'])) {
             foreach ($alert_users as $user_id => $alert_user) {
                 if (!in_array($user_id, $file_data['staff_ids'])) {
                     // this user has permissions to receive alerts, but they're not assigned.
                     unset($alert_users[$user_id]);
                 }
             }
         } else {
             if (isset($alert_users[1])) {
                 unset($alert_users[1]);
                 // skip admin for now until we can control that option
             }
         }
         // dont set a notification to ourselves.
         if (isset($alert_users[module_security::get_loggedin_id()])) {
             unset($alert_users[module_security::get_loggedin_id()]);
         }
         $file_data['customer_name'] = '';
         $file_data['customer_link'] = '';
         if (isset($file_data['customer_id']) && $file_data['customer_id']) {
             $customer_data = module_customer::get_customer($file_data['customer_id']);
             $file_data['customer_name'] = $customer_data['customer_name'];
             $file_data['customer_link'] = module_customer::link_open($file_data['customer_id']);
         }
         $file_data['file_link'] = self::link_open($file_id);
         foreach ($alert_users as $alert_user) {
             if (isset($alert_user['customer_id']) && $alert_user['customer_id'] > 0) {
                 // only send this user an alert of the file is from this customer account.
                 if (!isset($file_data['customer_id']) || $file_data['customer_id'] != $alert_user['customer_id']) {
                     continue;
                     // skip this user
                 }
             }
             $notification_data = array('email_id' => 0, 'view_time' => 0, 'notification_type' => _FILE_NOTIFICATION_TYPE_COMMENTED, 'file_id' => $file_id, 'user_id' => $alert_user['user_id']);
             $template = module_template::get_template_by_key('file_comment_alert_email');
             $template->assign_values($file_data);
             $html = $template->render('html');
             // send an email to this user.
             $email = module_email::new_email();
             $email->file_id = $file_id;
             $email->replace_values = $file_data;
             $email->set_to('user', $alert_user['user_id']);
             $email->set_from('user', module_security::get_loggedin_id());
             $email->set_subject($template->description);
             // do we send images inline?
             $email->set_html($html);
             if ($email->send()) {
                 // it worked successfully!!
                 // sweet.
                 $notification_data['email_id'] = $email->email_id;
             } else {
                 /// log err?
                 set_error('Failed to send notification email to user id ' . $alert_users['user_id']);
             }
             update_insert('file_notification_id', 'new', 'file_notification', $notification_data);
         }
     }
 }
Ejemplo n.º 3
0
$template->assign_values(array('user_name' => htmlspecialchars($_SESSION['_user_name']), 'system_name' => htmlspecialchars(module_config::s('admin_system_name'))));
$widget_sort_json = @json_decode(module_config::c('dash_widgets_sort_' . module_security::get_loggedin_id()), true);
if (!is_array($widget_sort_json)) {
    $widget_sort_json = array();
}
$widget_sort_order = array();
$widget_sort_page_order = 1;
foreach ($widget_sort_json as $id => $vals) {
    $bits = explode('|', $vals);
    if (count($bits) == 3) {
        $widget_sort_order[$bits[2]] = array('column' => $bits[0], 'column_number' => $bits[1], 'page_order' => $widget_sort_page_order++);
    }
}
$widget_sort_id = 1;
// then display the alerts list.
if (module_config::c('dashboard_new_layout', 1) && class_exists('module_dashboard', false) && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Alerts')) {
    ob_start();
    module_dashboard::output_dashboard_alerts(module_config::c('dashboard_alerts_ajax', 1));
    array_unshift($home_widgets, array('columns' => isset($widget_sort_order[$widget_sort_id]['column']) ? $widget_sort_order[$widget_sort_id]['column'] : 1, 'column_number' => isset($widget_sort_order[$widget_sort_id]['column_number']) ? $widget_sort_order[$widget_sort_id]['column_number'] : false, 'page_order' => isset($widget_sort_order[$widget_sort_id]['page_order']) ? $widget_sort_order[$widget_sort_id]['page_order'] : false, 'sort_id' => $widget_sort_id++, 'title' => _l('Alerts'), 'content' => ob_get_clean()));
}
array_unshift($home_widgets, array('columns' => isset($widget_sort_order[$widget_sort_id]['column']) ? $widget_sort_order[$widget_sort_id]['column'] : 1, 'column_number' => isset($widget_sort_order[$widget_sort_id]['column_number']) ? $widget_sort_order[$widget_sort_id]['column_number'] : false, 'page_order' => isset($widget_sort_order[$widget_sort_id]['page_order']) ? $widget_sort_order[$widget_sort_id]['page_order'] : false, 'sort_id' => $widget_sort_id++, 'title' => _l('Home Page'), 'content' => _DEMO_MODE ? strip_tags($template->replace_content()) : $template->replace_content()));
// now grab the widgets from the various modules and add those in:
$widget_columns_counter = array();
foreach ($home_widgets as $module_widgets) {
    if (isset($module_widgets['id']) || isset($module_widgets['sort_id'])) {
        $module_widgets = array($module_widgets);
    }
    foreach ($module_widgets as $module_widget) {
        if (isset($widget_sort_order[$widget_sort_id]['column'])) {
            $module_widget['columns'] = $widget_sort_order[$widget_sort_id]['column'];
        }
Ejemplo n.º 4
0
                        <?php 
            }
            ?>

            </div>
        </div>

         <!-- header.head -->
        <header class="head">
            <div class="search-bar hidden-xs">
                <a data-original-title="Show/Hide Menu" data-placement="bottom" data-tooltip="tooltip" class="accordion-toggle btn btn-primary btn-sm visible-xs" data-toggle="collapse" href="#menu" id="menu-toggle">
                    <i class="fa fa-resize-full"></i>
                </a>

                <?php 
            if (module_security::getcred() && module_security::can_user(module_security::get_loggedin_id(), 'Show Quick Search')) {
                if (module_config::c('global_search_focus', 1) == 1) {
                    module_form::set_default_field('ajax_search_text');
                }
                ?>

                    <form class="main-search" action="<?php 
                echo _BASE_HREF;
                ?>
?p=search_results" method="post">
                        <div class="input-group">

                            <input type="text" class="input-small form-control" name="quicksearch" value="<?php 
                echo isset($_REQUEST['quicksearch']) ? htmlspecialchars($_REQUEST['quicksearch']) : '';
                ?>
" placeholder="<?php 
Ejemplo n.º 5
0
 public function handle_hook($hook, &$calling_module = false, $show_all = false)
 {
     switch ($hook) {
         case 'dashboard_widgets':
             // see finance for example of widget usage.
             break;
         case "home_alerts":
             $cache_timeout = module_config::c('cache_objects', 60);
             $cache_key = 'home_alerts_' . module_security::get_loggedin_id();
             $alerts = array();
             /*if(module_config::c('job_task_alerts',1)){
                   // find out any overdue tasks or jobs.
                   $sql = "SELECT t.*,p.name AS job_name FROM `"._DB_PREFIX."task` t ";
                   $sql .= " LEFT JOIN `"._DB_PREFIX."job` p USING (job_id) ";
                   $sql .= " WHERE t.date_due != '0000-00-00' AND t.date_due <= '".date('Y-m-d',strtotime('+'.module_config::c('alert_days_in_future',5).' days'))."' AND ((t.hours = 0 AND t.completed = 0) OR t.completed < t.hours)";
                   $tasks = qa($sql);
                   foreach($tasks as $task){
                       $alert_res = process_alert($task['date_due'], _l('Job: %s',$task['job_name']));
                       if($alert_res){
                           $alert_res['link'] = $this->link_open($task['job_id']);
                           $alert_res['name'] = $task['description'];
                           $alerts[] = $alert_res;
                       }
                   }
               }*/
             if ($show_all || module_config::c('job_alerts', 1)) {
                 // find any jobs that are past the due date and dont have a finished date.
                 $key = _l('Incomplete Job');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'progress' => _l('Job Progress'), 'assigned_staff' => _l('Staff'), 'date' => _l('Due Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns, 'sort' => array('time' => 'DESC')));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     //                        $sql = "SELECT * FROM `"._DB_PREFIX."job` p ";
                     //                        $sql .= " WHERE p.date_due != '0000-00-00' AND p.date_due <= '".date('Y-m-d',strtotime('+'.module_config::c('alert_days_in_future',5).' days'))."' AND p.date_completed = '0000-00-00'";
                     //                        $tasks = qa($sql);
                     $jobs = self::get_jobs(array(), array('custom_where' => " AND u.date_due != '0000-00-00' AND u.date_due <= '" . date('Y-m-d', strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days')) . "' AND u.date_completed = '0000-00-00'"));
                     foreach ($jobs as $job_data) {
                         // permission check:
                         //                            $job_data = self::get_job($task['job_id']);
                         //                            if(!$job_data || $job_data['job_id']!=$task['job_id'])continue;
                         $alert_res = process_alert($job_data['date_due'], 'temp');
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($job_data['job_id'], false, $job_data);
                             $alert_res['name'] = $job_data['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($alert_res['date']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($job_data['job_id'], true, $job_data);
                             $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job_data['website_id'] ? module_website::link_open($job_data['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job_data['user_id'] ? module_user::link_open($job_data['user_id'], true) : _l('N/A');
                             $alert_res['progress'] = $job_data['total_percent_complete'] * 100 . '%';
                             $alert_res['date'] = print_date($alert_res['date']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts['jobincomplete' . $job_data['job_id']] = $alert_res;
                         }
                     }
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key . ' #2'));
                     // find any jobs that haven't started yet (ie: have a start date, but no completed tasks)
                     //                        $sql = "SELECT * FROM `"._DB_PREFIX."job` p ";
                     //                        $sql .= " WHERE p.date_completed = '0000-00-00' AND p.date_start != '0000-00-00' AND p.date_start <= '".date('Y-m-d',strtotime('+'.module_config::c('alert_days_in_future',5).' days'))."'";
                     //                        $jobs = qa($sql);
                     $jobs = self::get_jobs(array(), array('custom_where' => " AND u.date_completed = '0000-00-00' AND u.date_due = '0000-00-00' AND u.date_start != '0000-00-00' AND u.date_start <= '" . date('Y-m-d', strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days')) . "'"));
                     foreach ($jobs as $job_data) {
                         //$job_data = self::get_job($job['job_id']);
                         //if(!$job_data || $job_data['job_id']!=$job['job_id'])continue;
                         /*$job_started=true;
                                                     if(module_config::c('job_start_alerts_old',0)){
                                                         $tasks = self::get_tasks($job['job_id']);
                                                         $job_started = false;
                                                         foreach($tasks as $task){
                                                             if($task['fully_completed']){
                                                                 $job_started = true;
                                                                 break;
                                                             }
                                                         }
                                                     }
                                                     if(!$job_started){
                         
                                                         $alert_res = process_alert($job['date_start'], _l('Job Not Started'));
                                                         if($alert_res){
                                                             $alert_res['link'] = $this->link_open($job['job_id'],false,$job);
                                                             $alert_res['name'] = $job['name'];
                                                             $alerts[] = $alert_res;
                                                         }
                                                     }else{*/
                         // do the same alert as above.
                         if (!isset($this_alerts['jobincomplete' . $job_data['job_id']])) {
                             $alert_res = process_alert($job_data['date_start'], $key);
                             if ($alert_res) {
                                 $alert_res['link'] = $this->link_open($job_data['job_id'], false, $job_data);
                                 $alert_res['name'] = $job_data['name'];
                                 // new dashboard alert layout here:
                                 $alert_res['time'] = strtotime($alert_res['date']);
                                 $alert_res['group'] = $key;
                                 $alert_res['job'] = $this->link_open($job_data['job_id'], true, $job_data);
                                 $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                                 $alert_res['website'] = $job_data['website_id'] ? module_website::link_open($job_data['website_id'], true) : _l('N/A');
                                 $alert_res['assigned_staff'] = $job_data['user_id'] ? module_user::link_open($job_data['user_id'], true) : _l('N/A');
                                 $alert_res['progress'] = $job_data['total_percent_complete'] * 100 . '%';
                                 $alert_res['date'] = print_date($alert_res['date']);
                                 $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                                 $this_alerts['jobincomplete' . $job_data['job_id']] = $alert_res;
                             }
                         }
                         /* }*/
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if (module_config::c('job_allow_quotes', 0) && ($show_all || module_config::c('job_quote_alerts', 1))) {
                 // find any jobs that dont have a start date yet.
                 $key = _l('Pending Job Quote');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'date' => _l('Quoted Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     //$sql = "SELECT * FROM `"._DB_PREFIX."job` p ";
                     //$sql .= " WHERE p.date_quote != '0000-00-00' AND p.date_start = '0000-00-00'";
                     //$tasks = qa($sql);
                     $jobs = self::get_jobs(array('date_start' => '0000-00-00', 'date_quote' => '!0000-00-00'));
                     foreach ($jobs as $job_data) {
                         //$job_data = self::get_job($task['job_id']);
                         //if(!$job_data || $job_data['job_id']!=$task['job_id'])continue;
                         $alert_res = process_alert($job_data['date_quote'], $key);
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($job_data['job_id'], false, $job_data);
                             $alert_res['name'] = $job_data['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($job_data['date_quote']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($job_data['job_id'], true, $job_data);
                             $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job_data['website_id'] ? module_website::link_open($job_data['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job_data['user_id'] ? module_user::link_open($job_data['user_id'], true) : _l('N/A');
                             //$alert_res['progress'] = ($job_data['total_percent_complete'] * 100).'%';
                             $alert_res['date'] = print_date($alert_res['date']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if ($show_all || module_config::c('job_invoice_alerts', 1)) {
                 // find any completed jobs that don't have an invoice.
                 $key = _l('Please Generate Invoice');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'invoicable_amount' => _l('Invoiceable Amount'), 'date' => _l('Completed Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     $sql = "SELECT j.* FROM `" . _DB_PREFIX . "job` j ";
                     $from = " LEFT JOIN `" . _DB_PREFIX . "task` t USING (job_id) ";
                     $from .= " LEFT JOIN `" . _DB_PREFIX . "invoice_item` ii ON t.task_id = ii.task_id ";
                     $from .= " LEFT JOIN `" . _DB_PREFIX . "invoice` i ON ii.invoice_id = i.invoice_id  ";
                     $where = " WHERE i.invoice_id IS NULL AND (j.date_completed != '0000-00-00')";
                     switch (self::get_job_access_permissions()) {
                         case _JOB_ACCESS_ALL:
                             break;
                         case _JOB_ACCESS_ASSIGNED:
                             // only assigned jobs!
                             //$from .= " LEFT JOIN `"._DB_PREFIX."task` t ON u.job_id = t.job_id ";
                             $where .= " AND (j.user_id = " . (int) module_security::get_loggedin_id() . " OR t.user_id = " . (int) module_security::get_loggedin_id() . ")";
                             break;
                         case _JOB_ACCESS_CUSTOMER:
                             // tie in with customer permissions to only get jobs from customers we can access.
                             $customers = module_customer::get_customers();
                             if (count($customers)) {
                                 $where .= " AND j.customer_id IN ( ";
                                 foreach ($customers as $customer) {
                                     $where .= $customer['customer_id'] . ', ';
                                 }
                                 $where = rtrim($where, ', ');
                                 $where .= " ) ";
                             }
                             break;
                     }
                     // tie in with customer permissions to only get jobs from customers we can access.
                     switch (module_customer::get_customer_data_access()) {
                         case _CUSTOMER_ACCESS_ALL:
                             // all customers! so this means all jobs!
                             break;
                         case _CUSTOMER_ACCESS_ALL_COMPANY:
                         case _CUSTOMER_ACCESS_CONTACTS:
                         case _CUSTOMER_ACCESS_TASKS:
                         case _CUSTOMER_ACCESS_STAFF:
                             $valid_customer_ids = module_security::get_customer_restrictions();
                             if (count($valid_customer_ids)) {
                                 $where .= " AND ( j.customer_id = 0 OR j.customer_id IN ( ";
                                 foreach ($valid_customer_ids as $valid_customer_id) {
                                     $where .= (int) $valid_customer_id . ", ";
                                 }
                                 $where = rtrim($where, ', ');
                                 $where .= " )";
                                 $where .= " )";
                             }
                     }
                     $res = qa($sql . $from . $where . " GROUP BY j.job_id");
                     foreach ($res as $job) {
                         if (!isset($job['c_total_amount_invoicable']) || $job['c_total_amount_invoicable'] < 0) {
                             $this->update_job_completion_status($job['job_id']);
                             // seed the cache
                             $job = $this->get_job($job['job_id']);
                         }
                         //$job = $this->get_job($r['job_id']);
                         //if($job && $job['job_id'] == $r['job_id'] && $job['total_amount_invoicable'] > 0 && module_invoice::can_i('create','Invoices')){
                         if (isset($job['c_total_amount_invoicable']) && $job['c_total_amount_invoicable'] > 0 && module_invoice::can_i('create', 'Invoices')) {
                             $alert_res = process_alert($job['date_completed'], $key);
                             if ($alert_res) {
                                 $alert_res['link'] = $this->link_open($job['job_id'], false, $job);
                                 $alert_res['name'] = $job['name'];
                                 // new dashboard alert layout here:
                                 $alert_res['time'] = strtotime($job['date_completed']);
                                 $alert_res['group'] = $key;
                                 $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                                 $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                                 $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                                 $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                                 $alert_res['invoicable_amount'] = currency($job['c_total_amount_invoicable'], true, $job['currency_id']);
                                 //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                                 $alert_res['date'] = print_date($alert_res['date']);
                                 $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                                 $this_alerts[] = $alert_res;
                             }
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if ($show_all || module_config::c('job_renew_alerts', 1)) {
                 // find any jobs that have a renew date soon and have not been renewed.
                 $key = _l('Job Renewal Pending');
                 $key_auto = _l('Automatic Job Renewal Pending');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'renewal_period' => _l('Period'), 'date_create' => _l('Created Date'), 'date' => _l('Renewal Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'renewal_period' => _l('Period'), 'date_create' => _l('Created Date'), 'date' => _l('Renewal Date'), 'renew_invoice' => _l('Automatic Invoice'), 'days' => _l('Day Count'));
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key_auto, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     /*$sql = "SELECT p.* FROM `"._DB_PREFIX."job` p ";
                       $sql .= " WHERE p.date_renew != '0000-00-00'";
                       $sql .= " AND p.date_renew <= '".date('Y-m-d',strtotime('+'.module_config::c('alert_days_in_future',5).' days'))."'";
                       $sql .= " AND (p.renew_job_id IS NULL OR p.renew_job_id = 0)";
                       $res = qa($sql);*/
                     $res = self::get_jobs(array(), array('custom_where' => " AND  u.date_renew != '0000-00-00' AND u.date_renew <= '" . date('Y-m-d', strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days')) . "' AND (u.renew_job_id IS NULL OR u.renew_job_id = 0)"));
                     foreach ($res as $job) {
                         //$job = self::get_job($r['job_id']);
                         //if(!$job || $job['job_id']!=$r['job_id'])continue;
                         if ($job['renew_auto']) {
                             $alert_res = process_alert($job['date_renew'], $key_auto);
                         } else {
                             $alert_res = process_alert($job['date_renew'], $key);
                         }
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($job['job_id'], false, $job);
                             $alert_res['name'] = $job['name'];
                             $alert_res['renewal_period'] = _l('N/A');
                             // work out renewal period
                             if ($job['date_start'] && $job['date_start'] != '0000-00-00') {
                                 $time_diff = strtotime($job['date_renew']) - strtotime($job['date_start']);
                                 if ($time_diff > 0) {
                                     $diff_type = 'day';
                                     $days = round($time_diff / 86400);
                                     if ($days >= 365) {
                                         $time_diff = round($days / 365, 1);
                                         $diff_type = 'year';
                                     } else {
                                         $time_diff = $days;
                                     }
                                     $alert_res['renewal_period'] = $time_diff . ' ' . $diff_type;
                                 }
                             }
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($job['date_renew']);
                             if ($job['renew_auto']) {
                                 $alert_res['group'] = $key_auto;
                                 $alert_res['renew_invoice'] = $job['renew_invoice'] ? _l('Yes') : _l('No');
                             } else {
                                 $alert_res['group'] = $key;
                             }
                             $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                             $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                             //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                             $alert_res['date_create'] = print_date($job['date_start']);
                             $alert_res['date'] = print_date($job['date_renew']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if ($show_all || module_config::c('job_approval_alerts', 1)) {
                 $job_task_creation_permissions = self::get_job_task_creation_permissions();
                 if ($job_task_creation_permissions == _JOB_TASK_CREATION_WITHOUT_APPROVAL) {
                     // find any jobs that have tasks requiring approval
                     $key = _l('Tasks Require Approval');
                     if (class_exists('module_dashboard', false)) {
                         $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'task_count' => _l('Tasks to Approve'), 'date' => _l('Task Date'), 'days' => _l('Day Count'));
                         if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                             unset($columns['website']);
                         }
                         if (!module_customer::can_i('view', 'Customers')) {
                             unset($columns['customer']);
                         }
                         module_dashboard::register_group($key, array('columns' => $columns));
                     }
                     if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                         $alerts = array_merge($alerts, $cached_alerts);
                     } else {
                         module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                         $this_alerts = array();
                         $sql = "SELECT p.job_id,p.name, t.date_updated, t.date_created, COUNT(t.task_id) AS approval_count FROM `" . _DB_PREFIX . "job` p ";
                         $sql .= " LEFT JOIN `" . _DB_PREFIX . "task` t ON p.job_id = t.job_id";
                         $sql .= " WHERE t.approval_required = 1";
                         $sql .= " GROUP BY p.job_id ";
                         $res = qa($sql);
                         foreach ($res as $r) {
                             $job = self::get_job($r['job_id']);
                             if (!$job || $job['job_id'] != $r['job_id']) {
                                 continue;
                             }
                             $alert_res = process_alert($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created'], $key);
                             if ($alert_res) {
                                 $alert_res['link'] = $this->link_open($r['job_id'], false, $r);
                                 $alert_res['name'] = $r['name'];
                                 // new dashboard alert layout here:
                                 $alert_res['time'] = strtotime($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created']);
                                 $alert_res['group'] = $key;
                                 $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                                 $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                                 $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                                 $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                                 //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                                 $alert_res['task_count'] = $r['approval_count'];
                                 $alert_res['date'] = print_date($alert_res['time']);
                                 $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                                 $this_alerts[] = $alert_res;
                             }
                         }
                         module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                         $alerts = array_merge($alerts, $this_alerts);
                     }
                 }
                 // find any rejected tasks
                 $key = _l('Tasks Have Been Rejected');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'task_count' => _l('Tasks Rejected'), 'date' => _l('Task Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     $sql = "SELECT p.job_id,p.name, t.date_updated, t.date_created, COUNT(t.task_id) AS approval_count FROM `" . _DB_PREFIX . "job` p ";
                     $sql .= " LEFT JOIN `" . _DB_PREFIX . "task` t ON p.job_id = t.job_id";
                     $sql .= " WHERE t.approval_required = 2";
                     $sql .= " GROUP BY p.job_id ";
                     $res = qa($sql);
                     foreach ($res as $r) {
                         $job = self::get_job($r['job_id']);
                         if (!$job || $job['job_id'] != $r['job_id']) {
                             continue;
                         }
                         $alert_res = process_alert($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created'], $key);
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($r['job_id'], false, $r);
                             $alert_res['name'] = $r['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                             $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                             //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                             $alert_res['task_count'] = $r['approval_count'];
                             $alert_res['date'] = print_date($alert_res['time']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if (module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Todo List')) {
                 $key = _l('Job Todo');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer Name'), 'progress' => _l('Task Progress'), 'task' => _l('Task Description'), 'assigned_staff' => _l('Staff'), 'date' => _l('Due Date'), 'days' => _l('Day Count'));
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     $todo_list = self::get_tasks_todo();
                     $x = 0;
                     foreach ($todo_list as $todo_item) {
                         if ($todo_item['hours_completed'] > 0) {
                             if ($todo_item['hours'] > 0) {
                                 $percentage = round($todo_item['hours_completed'] / $todo_item['hours'], 2);
                                 $percentage = min(1, $percentage);
                             } else {
                                 $percentage = 1;
                             }
                         } else {
                             $percentage = 0;
                         }
                         $job_data = module_job::get_job($todo_item['job_id'], false);
                         $alert_res = process_alert($todo_item['date_due'], 'temp');
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($todo_item['job_id'], false, $job_data);
                             $alert_res['name'] = $percentage * 100 . '% ' . $todo_item['description'];
                             $alert_res['item'] = $job_data['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($alert_res['date']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($todo_item['job_id'], true, $job_data);
                             $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $todo_item['user_id'] ? module_user::link_open($todo_item['user_id'], true) : _l('N/A');
                             $alert_res['progress'] = $percentage * 100 . '%';
                             $alert_res['task'] = htmlspecialchars($todo_item['description']);
                             $alert_res['date'] = $alert_res['warning'] ? '<span class="important">' . print_date($alert_res['date']) . '</span>' : print_date($alert_res['date']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             return $alerts;
             break;
     }
     return false;
 }
Ejemplo n.º 6
0
                <?php 
        }
        ?>

                </tbody>
            </table>
                </div>
                <?php 
    }
    ?>

        </td>
        <td valign="top">

            <?php 
    if (class_exists('module_job', false) && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Todo List')) {
        ?>


            <?php 
        print_heading(array('title' => 'Todo List', 'type' => 'h3'));
        ?>

                <div class="content_box_wheader">

             <table class="tableclass tableclass_rows tableclass_full">
                <tbody>
                <?php 
        $todo_list = module_job::get_tasks_todo();
        $x = 0;
        if (!count($todo_list)) {
Ejemplo n.º 7
0
<?php

/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca, 0a3014a3-2b8f-460b-8850-d6025aa845f8
 * Package Date: 2015-11-25 03:08:08 
 * IP Address: 67.79.165.254
 */
if (class_exists('module_customer', false) && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Widgets')) {
    $customer_types = module_customer::get_customer_types();
    foreach ($customer_types as $customer_type) {
        // if(!empty($customer_type['type_name_plural']) && $customer_type['customer_type_id']) { // dtbaker
        if (!empty($customer_type['type_name_plural'])) {
            // dtbaker
            if (module_customer::can_i('view', $customer_type['type_name_plural'])) {
                // find out how many open customers are left..
                $customers = module_customer::get_customers(array('customer_type_id' => $customer_type['customer_type_id']), true);
                ob_start();
                // icons from http://ionicons.com/
                ?>

				<div class="small-box bg-yellow">
					<div class="inner">
						<h3>
							<?php 
                echo mysql_num_rows($customers);
                ?>
						</h3>
Ejemplo n.º 8
0
    public function process()
    {
        if ("ajax_dashboard_tabs" == $_REQUEST['_process']) {
            header("Content-type: text/javascript");
            if (module_security::is_logged_in() && module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Alerts')) {
                $items_to_hide = json_decode(module_config::c('_dashboard_item_hide' . module_security::get_loggedin_id(), '{}'), true);
                if (!is_array($items_to_hide)) {
                    $items_to_hide = array();
                }
                //$results = handle_hook("home_alerts");
                global $plugins;
                $tabid = 1;
                // Implicitly flush the buffer(s)
                @ini_set('implicit_flush', true);
                @ob_implicit_flush(true);
                ?>

	            var tabs = $('#dashboard_tabs'); //.tabs();
	            var ul = tabs.find( "ul" );
	            <?php 
                if (is_array($plugins)) {
                    foreach ($plugins as $plugin_name => $plugin) {
                        if (is_callable(array($plugin, 'handle_hook'))) {
                            $argv = array('home_alerts');
                            $this_return = call_user_func_array(array(&$plugin, 'handle_hook'), $argv);
                            if ($this_return !== false && $this_return !== null && is_array($this_return) && count($this_return)) {
                                // we found some home dashboard alerts! yew! print these out for our ajax display and exit, waiting for the next one.
                                uasort($this_return, 'sort_ajax_alert');
                                $dashboard_alerts = array();
                                foreach ($this_return as $alert) {
                                    $group_key = isset($alert['group']) ? $alert['group'] : $alert['item'];
                                    if (!isset($dashboard_alerts[$group_key])) {
                                        $dashboard_alerts[$group_key] = array();
                                    }
                                    $dashboard_alerts[$group_key][] = $alert;
                                }
                                if (!isset($_REQUEST['show_hidden'])) {
                                    foreach ($dashboard_alerts as $key => $val) {
                                        // see if any of these "$val" alert entries are marked as hidden
                                        foreach ($val as $k => $v) {
                                            $hide_key = md5($v['link'] . $v['item'] . (isset($v['name']) ? $v['name'] : ''));
                                            $dashboard_alerts[$key][$k]['hide_key'] = $val[$k]['hide_key'] = $hide_key;
                                            if (in_array($hide_key, $items_to_hide)) {
                                                unset($val[$k]);
                                                unset($dashboard_alerts[$key][$k]);
                                            }
                                        }
                                    }
                                }
                                //print_r($dashboard_alerts);
                                foreach ($dashboard_alerts as $key => $alerts) {
                                    if (!count($alerts)) {
                                        continue;
                                    }
                                    $tabid++;
                                    ?>

	                                $( "<li><a href='#newtab<?php 
                                    echo $tabid;
                                    ?>
'><?php 
                                    echo $key;
                                    ?>
 (<?php 
                                    echo count($alerts);
                                    ?>
)</a></li>" ).appendTo( ul );
	                                <?php 
                                    ob_start();
                                    if (isset(module_dashboard::$group_settings[$key])) {
                                        ?>

	                                <table class="tableclass tableclass_rows tableclass_full" id="alert_table_<?php 
                                        echo strtolower(str_replace(' ', '', $key));
                                        ?>
">
	                                    <thead>
		                                    <tr>
		                                        <?php 
                                        foreach (module_dashboard::$group_settings[$key]['columns'] as $column_key => $column_title) {
                                            ?>

		                                        <th class="alert_column_<?php 
                                            echo $column_key;
                                            ?>
"><?php 
                                            echo $column_title;
                                            ?>
</th>
		                                        <?php 
                                        }
                                        ?>

		                                        <th width="10" class="alert_column_delete"></th>
		                                    </tr>
	                                    </thead>
	                                    <tbody>
	                                        <?php 
                                        if (count($alerts)) {
                                            $y = 0;
                                            foreach ($alerts as $alert) {
                                                ?>

	                                                <tr class="<?php 
                                                echo $y++ % 2 ? 'even' : 'odd';
                                                ?>
">
	                                                    <?php 
                                                foreach (module_dashboard::$group_settings[$key]['columns'] as $column_key => $column_title) {
                                                    ?>

	                                                    <td><?php 
                                                    echo isset($alert[$column_key]) ? $alert[$column_key] : '';
                                                    ?>
</td>
	                                                    <?php 
                                                }
                                                ?>

	                                                    <?php 
                                                if (isset($alert['hide_key']) && $alert['hide_key']) {
                                                    ?>

	                                                    <td width="10">
	                                                        <a href="#" class="ui-corner-all ui-icon ui-icon-trash" onclick="return hide_item('<?php 
                                                    echo $alert['hide_key'];
                                                    ?>
');">[x]</a>
	                                                    </td>
	                                                    <?php 
                                                }
                                                ?>

	                                                </tr>
	                                            <?php 
                                            }
                                        } else {
                                            ?>

	                                            <tr>
	                                                <td class="odd" colspan="4"><?php 
                                            _e('Yay! No alerts!');
                                            ?>
</td>
	                                            </tr>
	                                        <?php 
                                        }
                                        ?>

	                                    </tbody>
	                                </table>
	                                <?php 
                                    } else {
                                        // old method of output for unregistered alerts:
                                        // will remove once all have been converted.
                                        ?>

	                            <table class="tableclass tableclass_rows tableclass_full tbl_fixed" id="alert_table_<?php 
                                        echo strtolower(str_replace(' ', '', $key));
                                        ?>
">
	                                    <tbody>
	                                    <?php 
                                        if (count($alerts)) {
                                            $y = 0;
                                            foreach ($alerts as $alert) {
                                                ?>

	                                            <tr class="<?php 
                                                echo $y++ % 2 ? 'even' : 'odd';
                                                ?>
">
	                                                <td class="row_action">
	                                                    <a href="<?php 
                                                echo $alert['link'];
                                                ?>
"><?php 
                                                echo htmlspecialchars($alert['item']);
                                                ?>
</a>
	                                                </td>
	                                                    <td>
	                                                        <?php 
                                                echo isset($alert['name']) ? htmlspecialchars($alert['name']) : '';
                                                ?>

	                                                    </td>
	                                                    <td width="16%">
	                                                        <?php 
                                                echo $alert['warning'] ? '<span class="important">' : '';
                                                ?>

	                                                        <?php 
                                                echo $alert['days'];
                                                ?>

	                                                        <?php 
                                                echo $alert['warning'] ? '</span>' : '';
                                                ?>

	                                                    </td>
	                                                <td width="16%">
	                                                    <?php 
                                                echo $alert['warning'] ? '<span class="important">' : '';
                                                ?>

	                                                    <?php 
                                                echo print_date($alert['date']);
                                                ?>

	                                                    <?php 
                                                echo $alert['warning'] ? '</span>' : '';
                                                ?>

	                                                </td>
	                                                <?php 
                                                if (isset($alert['hide_key']) && $alert['hide_key']) {
                                                    ?>

	                                                <td width="10">
	                                                    <a href="#" class="ui-corner-all ui-icon ui-icon-trash" onclick="return hide_item('<?php 
                                                    echo $alert['hide_key'];
                                                    ?>
');">[x]</a>
	                                                </td>
	                                                <?php 
                                                }
                                                ?>

	                                            </tr>
	                                        <?php 
                                            }
                                        } else {
                                            ?>

	                                        <tr>
	                                            <td class="odd" colspan="4"><?php 
                                            _e('Yay! No alerts!');
                                            ?>
</td>
	                                        </tr>
	                                    <?php 
                                        }
                                        ?>

	                                    </tbody>
	                                </table>
	                            <?php 
                                    }
                                    // end old method
                                    $html = ob_get_clean();
                                    $html = preg_replace('#\\s+#', ' ', $html);
                                    $html = addcslashes($html, "'");
                                    ?>

	                                $( '<div id="newtab<?php 
                                    echo $tabid;
                                    ?>
"><?php 
                                    echo $html;
                                    ?>
</div>' ).appendTo( tabs );
	                                <?php 
                                }
                                ?>

	                            tabs.tabs( "refresh" );
	                            <?php 
                                for ($x = 1; $x < 50; $x++) {
                                    echo " \t \n";
                                }
                                @flush();
                                @ob_end_flush();
                            } else {
                                // nothing? continue onto next hook...
                            }
                        }
                    }
                }
            }
            ?>

            $('#tabs_loading').hide();
            <?php 
            exit;
        }
    }
Ejemplo n.º 9
0
 public static function get_staff_members()
 {
     if (is_array(self::$_staff_members_cache)) {
         return self::$_staff_members_cache;
     }
     // todo: a different kinda perimssion outlines staff members maybe?
     if (module_config::c('staff_by_flag', 0)) {
         $label = 'Staff Member';
         // seed security permission:
         module_security::can_user(module_security::get_loggedin_id(), $label);
         // find any that exist.
         $staff = self::get_users_by_permission(array('category' => _LABEL_USER_SPECIFIC, 'name' => 'Staff Member', 'module' => 'config', 'view' => 1, 'description' => 'checkbox'));
     } else {
         $staff = self::get_users_by_permission(array('category' => 'Job', 'name' => 'Job Tasks', 'module' => 'job', 'edit' => 1));
     }
     foreach ($staff as $staff_id => $s) {
         if (isset($s['is_staff']) && $s['is_staff'] == 0) {
             // user has staff option manually disabled override the role settings.
             unset($staff[$staff_id]);
         }
     }
     // add any staff members that have the new is_staff flag set
     $staff_users = self::get_users(array('is_staff' => 1));
     if (!is_array($staff_users)) {
         $staff_users = array();
     }
     $staff_contacts = self::get_contacts(array('is_staff' => 1));
     if (!is_array($staff_contacts)) {
         $staff_contacts = array();
     }
     $staff = $staff + $staff_users + $staff_contacts;
     if (module_config::c('staff_remove_admin', 0) && isset($staff[module_config::c('staff_remove_admin', 0)])) {
         unset($staff[module_config::c('staff_remove_admin', 0)]);
     }
     self::$_staff_members_cache = $staff;
     return self::$_staff_members_cache;
 }