Example #1
0
 function parseUserInfo_user_regdate($val)
 {
     if (strstr($val, '-')) {
         return convert_date($val);
     } else {
         return convert_date(date('Y-m-d H:i:s', $val));
     }
 }
 /**
  * View filed transpo request.
  */
 public function viewfiledtranspo()
 {
     $this->load->model(array('employees', 'transpoallowance'));
     $this->load->library(array('transport'));
     $this->load->helper(array('my_datetime_helper'));
     $this->transpoallowance->load($this->uri->segment(3));
     $this->employees->load($this->transpoallowance->EmployeeNumber);
     $data['transpoallowance'] = $this->transpoallowance;
     $data['employee'] = $this->employees;
     $data['coverage'] = $this->transport->transpo_coverage($this->transpoallowance->EmployeeNumber, convert_date($this->transpoallowance->Datefrom, "Y-m-d"), convert_date($this->transpoallowance->Dateto, "Y-m-d"));
     $this->load->view('transpohrapproval/viewfiledtranspo', $data);
 }
function new_demande($new_debut, $new_demi_jour_deb, $new_fin, $new_demi_jour_fin, $new_nb_jours, $new_comment, $new_type, $DEBUG = FALSE)
{
    //conversion des dates
    $new_debut = convert_date($new_debut);
    $new_fin = convert_date($new_fin);
    // print_r($new_fin);
    //$new_nb_jours = get_nb_jour($new_debut, $new_fin, $new_demi_jour_deb, $new_demi_jour_fin);
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    // echo " $new_debut, $new_demi_jour_deb, $new_fin, $new_demi_jour_fin, $new_nb_jours, $new_comment, $new_type<br><br>\n";
    // exit;
    // verif validité des valeurs saisies
    $valid = verif_saisie_new_demande($new_debut, $new_demi_jour_deb, $new_fin, $new_demi_jour_fin, $new_nb_jours, $new_comment);
    // verifie que le solde de conges sera encore positif après validation
    if ($_SESSION['config']['solde_toujours_positif']) {
        $valid = $valid && verif_solde_user($_SESSION['userlogin'], $new_type, $new_nb_jours, $DEBUG);
    }
    if ($valid) {
        if (in_array(get_type_abs($new_type, $DEBUG), array('conges', 'conges_exceptionnels'))) {
            $new_etat = 'demande';
        } else {
            $new_etat = 'ok';
        }
        $new_comment = addslashes($new_comment);
        $periode_num = insert_dans_periode($_SESSION['userlogin'], $new_debut, $new_demi_jour_deb, $new_fin, $new_demi_jour_fin, $new_nb_jours, $new_comment, $new_type, $new_etat, 0, $DEBUG);
        if ($periode_num != 0) {
            echo schars(_('form_modif_ok')) . ' !<br><br>' . "\n";
            //envoi d'un mail d'alerte au responsable (si demandé dans config de php_conges)
            if ($_SESSION['config']['mail_new_demande_alerte_resp']) {
                alerte_mail($_SESSION['userlogin'], ":responsable:", $periode_num, "new_demande", $DEBUG);
            }
        } else {
            echo schars(_('form_modif_not_ok')) . ' !<br><br>' . "\n";
        }
    } else {
        echo schars(_('resp_traite_user_valeurs_not_ok')) . ' !<br><br>' . "\n";
    }
    /* RETOUR PAGE PRINCIPALE */
    // echo '<form action="'.$PHP_SELF.'?session='.$session.'" method="POST">';
    // echo '<input type="submit" value="'. _('form_retour') .'">';
    // echo '</form>';
    echo "<a class=\"btn\" href=\"{$PHP_SELF}?session={$session}\">" . _('form_retour') . "</a>\n";
}
Example #4
0
 /**
  * Retrieve list of sick leaves that may or may not require medical 
  * certificates.
  * 
  * @param date $datefrom
  * @param date $dateto
  * @return string
  */
 public function sick_leaves($start = NULL, $end = NULL)
 {
     // If date parameters are empty set it to the current date.
     $sdate = iif(isset($start), $start, date('Y-m-d'));
     $edate = iif(isset($end), $end, date('Y-m-d'));
     $empty[] = array('No results found.', '', '', '', '', '', '');
     $params = array('header' => $this->_tableheaders, 'class' => array('table table-striped table-bordered dt-table'));
     $this->_ci->load->library('MY_table', $params, 'medcerts');
     $sickleaves = $this->_ci->employeeleavesfiled->medcerts($sdate, $edate);
     if (isset($sickleaves) && !empty($sickleaves)) {
         for ($i = 0; $i < count($sickleaves); $i++) {
             $tabledata[] = array(convert_date($sickleaves[$i]->DateFiled, 'M d, Y'), $sickleaves[$i]->Name, convert_date($sickleaves[$i]->LeaveFrom, 'M d, Y'), convert_date($sickleaves[$i]->LeaveTo, 'M d, Y'), $sickleaves[$i]->LeaveCount, leave_status($sickleaves[$i]), $this->_check_medcert($sickleaves[$i]->WithMedCert, $sickleaves[$i]->LeaveID));
         }
         if (isset($tabledata) && !empty($tabledata)) {
             return $this->_ci->medcerts->generate($tabledata);
         } else {
             return $this->_ci->medcerts->generate($empty);
         }
     } else {
         return $this->_ci->medcerts->generate($empty);
     }
 }
function maketable($result, $fields)
{
    $num_papers = mysqli_num_rows($result);
    if ($num_papers != 0) {
        echo "<table class='papersTable'>";
        //var_dump($fields);
        //$fields = ["name", "filename", "author", "subject", "time"];
        echo "<tr>";
        for ($i = 0; $i < count($fields); $i++) {
            echo "<th>";
            echo $fields[$i];
            echo "</th>";
        }
        echo "</tr>";
        for ($i = 0; $i < $num_papers; $i++) {
            $row = mysqli_fetch_assoc($result);
            echo "<tr>";
            foreach ($fields as $key) {
                $val = $row[$key];
                if (!in_array($key, $fields)) {
                    continue;
                }
                if ($key == "time") {
                    $val = convert_date($val);
                }
                if ($key == "filename") {
                    $val = "<a href='../papers/{$val}'>{$val}</a>";
                    $val = substr($val, 0, strrpos($val, '_'));
                }
                echo "<td style= 'padding: 0px 10px;'>{$val}</td>";
            }
            unset($val);
            echo "</tr>";
            //var_dump($rows[$i]);
        }
        echo "</table>";
    }
}
 /**
  * Approve/ decline leave.
  */
 public function update()
 {
     $this->load->model(array('employeeleavesfiled', 'employeeleaves', 'leavetype'));
     $this->load->library('leave');
     $this->load->helper(array('my_datetime_helper'));
     $this->leavetype->Remarks = $this->db->escape($this->input->post('leavetype'));
     $type = $this->leavetype->get();
     $this->employeeleavesfiled->EmployeeNumber = $this->input->post('employeenumber');
     $this->employeeleavesfiled->LeaveFrom = convert_date($this->input->post('leavefrom'), 'Y-m-d H:i:s');
     $this->employeeleavesfiled->LeaveTo = convert_date($this->input->post('leaveto'), 'Y-m-d H:i:s');
     $this->employeeleavesfiled->LeaveCount = $this->input->post('count');
     $this->employeeleavesfiled->Type = $type[0]->LeaveType;
     $this->employeeleavesfiled->Reason = $this->input->post('leavereason');
     $this->employeeleavesfiled->Deleted = $this->input->post('status');
     $this->employeeleavesfiled->WithPay = $this->input->post('withpay');
     $this->employeeleavesfiled->AuditUser = '******';
     $this->employeeleavesfiled->AuditDate = date('Y-m-d H:i:s');
     $this->employeeleavesfiled->update($this->input->post('leaveid'));
     // Update leave credits
     // Leave is approved
     if ($this->input->post('status') == 0) {
         // Leave is with pay.
         if ($this->input->post('withpay') == 1) {
             $this->employees->load($this->input->post('employeenumber'));
             // Employees hired after May 31, 2013 have no sick leave credits.
             // They only earn vacation leave credits which can be used in place
             // of the sick leave.
             if (strtotime($this->employees->DateHired) > strtotime('May 31, 2013') && $this->input->post('leavetype') == 'Sick Leave') {
                 $leavetype = 'Vacation Leave';
             } else {
                 $leavetype = $this->input->post('leavetype');
             }
             $this->leave->updatecredits($this->input->post('employeenumber'), $leavetype, $this->input->post('leavefrom'), $this->input->post('leaveto'));
             // Update employee logs.
             $this->leave->leavedetails($this->input->post('leaveid'));
         }
     }
 }
Example #7
0
 /**
  * Get leaves by date. Will return json which will be consumed by the
  * fullcalendar.js plugin.
  *      
  */
 public function leavebydate()
 {
     $this->load->model(array('employeeleavesfiled'));
     $this->load->helper(array('my_datetime_helper'));
     $start = $this->input->get('start');
     $end = $this->input->get('end');
     $leaves = $this->employeeleavesfiled->get_leavesfiled_bydate($this->session->userdata('employeenumber'), $start, $end);
     $result = array();
     for ($i = 0; $i < count($leaves); $i++) {
         if ($leaves[$i]->Deleted == 1 && $leaves[$i]->WithPay == 0) {
             // Pending or not approved leave.
             $color = '#d6487e';
         } else {
             $color = '#82af6f';
         }
         // Notice the end date has a default time of 09:00:00, this is due
         // to the nextDayTreshold in fullcalendar.js
         // Refer to this link for the full explaination:
         // http://fullcalendar.io/docs/event_rendering/nextDayThreshold/
         $result[] = array('title' => $leaves[$i]->Reason, 'start' => convert_date($leaves[$i]->LeaveFrom, 'Y-m-d'), 'end' => convert_date($leaves[$i]->LeaveTo, 'Y-m-d 09:00:00'), 'leavetype' => trim($leaves[$i]->Type), 'color' => $color, 'leaveid' => $leaves[$i]->LeaveID);
     }
     echo json_encode($result);
 }
Example #8
0
function checknextfewdays($fecha, $feast, $num, $type, $month)
{
    if ($fecha) {
        $celebration = convert_date($fecha, $feast);
        if ($type == 'month') {
            $mes = explode("/", $celebration);
            if ($mes[1] == $month) {
                return true;
            } else {
                return false;
            }
        } elseif ($type == 'next') {
            $until = check_days($celebration);
            if ($until >= 0 && $until <= $num) {
                $until++;
                return $until;
            } else {
                return false;
            }
        }
    } else {
        return false;
    }
}
Example #9
0
 echo "<table cellpadding=\"2\">\n";
 $isData = false;
 while ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
     if (!$isData) {
         require_once 'includes/convert_date.php';
         echo "<tr><td valign=\"bottom\"><form action=\"gmembers.php\" method=\"post\"><input type=\"hidden\" name=\"group_id\" value=\"{$group_id}\"><input type=\"hidden\" name=\"orderby\" value=\"name\"><input type=\"submit\" class=\"{$btnUsername}\" value=\"" . T_("Username") . "\"></form></td><td valign=\"bottom\"><form action=\"gmembers.php\" method=\"post\"><input type=\"hidden\" name=\"group_id\" value=\"{$group_id}\"><input type=\"hidden\" name=\"orderby\" value=\"formatted_time\"><input type=\"submit\" class=\"{$btnDateJoin}\" value=\"" . T_("Date Joined") . "\"></form></td><td valign=\"bottom\"><form action=\"gmembers.php\" method=\"post\"><input type=\"hidden\" name=\"group_id\" value=\"{$group_id}\"><input type=\"hidden\" name=\"orderby\" value=\"priv\"><input type=\"submit\" class=\"{$btnPriv}\" value=\"" . T_("Privilege") . "\"></form></td>";
         if ($partOf) {
             //If the manager
             echo "<td>" . T_("Delete") . "</td><td align=\"center\"><b style=\"text-decoration:underline; cursor:pointer;\" onmouseover=\"return overlib('" . T_("Select the checkbox to remove all his bookmarks") . "');\" onmouseout=\"return nd();\">?</b></td>";
         }
         echo "</tr>\n";
         $isData = true;
     }
     $rec_name = "{$row["name"]}";
     $rec_date_join = "{$row["formatted_time"]}";
     $newDate = convert_date($rec_date_join);
     $rec_priv = "{$row["priv"]}";
     $priv = returnPrivName($rec_priv);
     // TODO: Review privileges, not using a db cause of translations
     $privn0 = returnPrivName('0');
     $privn1 = returnPrivName('1');
     $privn2 = returnPrivName('2');
     $priv0 = "0";
     $priv1 = "1";
     $priv2 = "2";
     switch ($rec_priv) {
         case 0:
             $priv0 .= "\" selected=\"selected";
             break;
         case 1:
             $priv1 .= "\" selected=\"selected";
 }
 if ($topic_title == '') {
     $topic_title = $l_emptyTopic;
 }
 if ($i > 0) {
     $bg = 'tbCel1';
 } else {
     $bg = 'tbCel2';
 }
 if (isset($mod_rewrite) and $mod_rewrite) {
     $urlp = "{$main_url}/{$forum}_{$topic}_";
 } else {
     $urlp = "{$main_url}/{$indexphp}action=vthread&amp;forum={$forum}&amp;topic={$topic}&amp;page=";
 }
 $pageNavCell = pageNav(0, $numReplies + 1, $urlp, $forum == $CONF['forum_submittedarticles'] || $forum == $CONF['forum_gallery'] ? 10 : $viewmaxreplys, TRUE);
 $whenPosted = convert_date($cols[4]);
 if (trim($cols[1]) == '') {
     $cols[1] = $l_emptyTopic;
 }
 //Forum icon
 if (isset($fIcon[$forum])) {
     $forumIcon = $fIcon[$forum];
 } else {
     $forumIcon = 'default.gif';
 }
 if (isset($mod_rewrite) and $mod_rewrite) {
     $linkToTopic = "{$main_url}/{$forum}_{$topic}_0.html";
 } else {
     $linkToTopic = "{$main_url}/{$indexphp}action=vthread&amp;forum={$forum}&amp;topic={$topic}";
 }
 $list_topics .= ParseTpl($tpl);
Example #11
0
function tzs_front_end_my_shipments_handler($atts)
{
    ob_start();
    global $wpdb;
    $user_id = get_current_user_id();
    $url = current_page_url();
    $page = current_page_number();
    $pp = TZS_RECORDS_PER_PAGE;
    $active = isset($_GET['active']) ? trim($_GET['active']) : '1';
    if ($user_id == 0) {
        ?>
        <div>Для просмотра необходимо <a href="/account/login/">войти</a> или <a href="/account/registration/">зарегистрироваться</a></div>
        <?php 
    } else {
        $sql = "SELECT COUNT(*) as cnt FROM " . TZS_SHIPMENT_TABLE . " WHERE user_id={$user_id} AND active={$active};";
        $res = $wpdb->get_row($sql);
        if (count($res) == 0 && $wpdb->last_error != null) {
            print_error('Не удалось отобразить список грузов. Свяжитесь, пожалуйста, с администрацией сайта');
        } else {
            $records = $res->cnt;
            $pages = ceil($records / $pp);
            if ($pages == 0) {
                $pages = 1;
            }
            if ($page > $pages) {
                $page = $pages;
            }
            $from = ($page - 1) * $pp;
            // Добавим отбор счетов и сортировку по ним для активных записей
            if ($active == 0) {
                $sql = "SELECT * FROM " . TZS_SHIPMENT_TABLE . "  WHERE user_id={$user_id} AND active={$active} ORDER BY time DESC LIMIT {$from},{$pp};";
            } else {
                $sql = "SELECT a.*,";
                $sql .= " b.id AS order_id,";
                $sql .= " b.number AS order_number,";
                $sql .= " b.status AS order_status,";
                $sql .= " b.dt_pay AS order_dt_pay,";
                $sql .= " b.dt_expired AS order_dt_expired,";
                $sql .= " IFNULL(b.dt_pay, a.time) AS dt_sort";
                $sql .= " FROM " . TZS_SHIPMENT_TABLE . " a";
                $sql .= " LEFT OUTER JOIN wp_tzs_orders b ON (b.tbl_type = 'SH' AND a.id = b.tbl_id AND ((b.status=1 AND b.dt_expired > NOW()) OR b.status=0) )";
                $sql .= " WHERE a.user_id={$user_id} AND a.active={$active}";
                $sql .= " ORDER BY order_status DESC, dt_sort DESC";
                $sql .= " LIMIT {$from},{$pp};";
            }
            $res = $wpdb->get_results($sql);
            if (count($res) == 0 && $wpdb->last_error != null) {
                print_error('Не удалось отобразить список транспорта. Свяжитесь, пожалуйста, с администрацией сайта');
            } else {
                ?>
                <script src="/wp-content/plugins/tzs/assets/js/distance.js"></script>
                <div id="my_products_wrapper">
                    <div id="my_products_table">
                        <table id="tbl_products">
                        <thead>
                            <tr id="tbl_thead_records_per_page">
                                <th colspan="4">
                                    <div class="div_td_left">
                                        <h3>Список <?php 
                echo $active === '1' ? 'публикуемых' : 'архивных';
                ?>
 грузов</h3>
                                    </div>
                                </th>
                                
                                <th colspan="6">
                                    <div id="my_products_button">
                                        <?php 
                if ($active === '1') {
                    ?>
                                            <button id="view_del" onClick="javascript: window.open('/account/my-shipments/?active=0', '_self');">Показать архивные</button>
                                        <?php 
                } else {
                    ?>
                                            <button id="view_edit" onClick="javascript: window.open('/account/my-shipments/?active=1', '_self');">Показать публикуемые</button>
                                        <?php 
                }
                ?>
                                        <button id="view_add" onClick="javascript: window.open('/account/add-shipment/', '_self');">Добавить груз</button>
                                    </div>
                                </th>
                            </tr>
                            <tr>
                                <th id="tbl_trucks_id">№, дата и время заявки</th>
                                <th id="tbl_trucks_path" nonclickable="true">Пункты погрузки /<br>выгрузки</th>
                                <th id="tbl_trucks_dtc">Дата погрузки /<br>выгрузки</th>
                                <th id="tbl_trucks_ttr">Тип груза</th>
                                <th id="tbl_trucks_wv">Вес,<br>объем</th>
                                <th id="tbl_trucks_comm">Описание груза</th>
                                <th id="tbl_trucks_cost">Стоимость,<br/>цена 1 км</th>
                                <th id="tbl_trucks_payment">Форма оплаты</th>
                                <th id="comm">Комментарии</th>
                                <th id="actions" nonclickable="true">Действия</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
                foreach ($res as $row) {
                    $type = trans_types_to_str($row->trans_type, $row->tr_type);
                    $cost = tzs_cost_to_str($row->cost, true);
                    ?>
                                <tr rid="<?php 
                    echo $row->id;
                    ?>
" <?php 
                    echo $row->order_status == 1 ? ' class="top_record"' : ($row->order_status !== null && $row->order_status == 0 ? ' class="pre_top_record"' : '');
                    ?>
 >
                                <td>
                                    <?php 
                    echo $row->id;
                    ?>
<br>
                                    <?php 
                    echo convert_time($row->time);
                    ?>
                                </td>
                                <td>
                                        <?php 
                    echo tzs_city_to_str($row->from_cid, $row->from_rid, $row->from_sid, $row->sh_city_from);
                    ?>
<br/><?php 
                    echo tzs_city_to_str($row->to_cid, $row->to_rid, $row->to_sid, $row->sh_city_to);
                    ?>
                                        <?php 
                    if ($row->distance > 0) {
                        ?>
                                                <br/>
                                                <?php 
                        echo tzs_make_distance_link($row->distance, false, array($row->sh_city_from, $row->sh_city_to));
                        ?>
                                        <?php 
                    }
                    ?>
                                </td>
                                <td><?php 
                    echo convert_date($row->sh_date_from);
                    ?>
<br/><?php 
                    echo convert_date($row->sh_date_to);
                    ?>
</td>

                                <td><?php 
                    echo $GLOBALS['tzs_sh_types'][$row->sh_type];
                    ?>
</td>
                                
                                <td>
                                <?php 
                    if ($row->sh_weight > 0) {
                        echo remove_decimal_part($row->sh_weight) . ' т<br>';
                    }
                    if ($row->sh_volume > 0) {
                        echo remove_decimal_part($row->sh_volume) . ' м³';
                    }
                    ?>
                                </td>

                                <td><?php 
                    echo htmlspecialchars($row->sh_descr);
                    ?>
</td>
                                <td>
                                    <?php 
                    if ($row->price > 0) {
                        echo $row->price . ' ' . $GLOBALS['tzs_curr'][$row->price_val] . '<br><br>';
                        echo round($row->price / $row->distance, 2) . ' ' . $GLOBALS['tzs_curr'][$row->price_val] . '/км';
                    }
                    ?>
                                </td>
                                <td><?php 
                    echo $cost[1];
                    ?>
</td>
                                <td><?php 
                    echo htmlspecialchars($row->comment);
                    ?>
</td>
                                <td>
                                        <a href="javascript:doDisplay(<?php 
                    echo $row->id;
                    ?>
);" at="<?php 
                    echo $row->id;
                    ?>
" id="icon_set">Действия</a>
                                        <div id="menu_set" id2="menu" for="<?php 
                    echo $row->id;
                    ?>
" style="display:none;">
                                                <ul>
                                                        <a href="/account/view-shipment/?id=<?php 
                    echo $row->id;
                    ?>
&link=my-shipments&active=<?php 
                    echo $active;
                    ?>
">Смотреть</a>
                                                        <a href="/account/edit-shipment/?id=<?php 
                    echo $row->id;
                    ?>
">Изменить</a>
                                                    <?php 
                    if ($row->active && $row->order_status === null) {
                        ?>
                                                        <a href="javascript:promptPickUp(<?php 
                        echo $row->id;
                        ?>
, 'SH');">В ТОП</a>
                                                    <?php 
                    }
                    ?>
                                                        
                                                    <?php 
                    if ($row->active && $row->order_status !== null && $row->order_status == 0) {
                        ?>
                                                        <a href="/account/view-order/?id=<?php 
                        echo $row->order_id;
                        ?>
">Счет ТОП</a>
                                                    <?php 
                    }
                    ?>
                                                        <a href="javascript: promptDelete(<?php 
                    echo $row->id . ', ' . $row->active;
                    ?>
);" id="red">Удалить</a>
                                                </ul>
                                        </div>
                                </td>
                                </tr>
                            <?php 
                }
                ?>
                        </tbody>
                        </table>
                    </div>
                </div>
                    
                <?php 
                include_once WP_PLUGIN_DIR . '/tzs/front-end/tzs.my.new_order.php';
                ?>
                

    <script src="/wp-content/plugins/tzs/assets/js/jquery.stickytableheaders.min.js"></script>
                    <script>
                    jQuery(document).ready(function(){
                            jQuery('table').on('click', 'td', function(e) {  
                                    var nonclickable = 'true' == e.delegateTarget.rows[1].cells[this.cellIndex].getAttribute('nonclickable');
                                    var id = this.parentNode.getAttribute("rid");
                                    if (!nonclickable)
                                            document.location = "/account/view-shipment/?id="+id+"&link=my-shipments&active=<?php 
                echo $active;
                ?>
";
                            });
                        
                            jQuery("#tbl_products").stickyTableHeaders();
                    });

                    function doDisplay(id) {
                            var el = jQuery('div[for='+id+']');
                            if (el.attr('style') == null) {
                                    el.attr('style', 'display:none;');
                                    jQuery('a[at='+id+']').attr('id', 'icon_set');
                            } else {
                                    el.removeAttr('style');
                                    jQuery('a[at='+id+']').attr('id', 'icon_set_cur');
                            }
                            jQuery("div[id2=menu]").each(function(i) {
                                    var id2 = this.getAttribute('for');
                                    if (id2 != ''+id) {
                                            this.setAttribute('style', 'display:none;');
                                            jQuery('a[at='+id2+']').attr('id', 'icon_set');
                                    }
                            });
                    }

                    function promptDelete(id, active) {
                    if (active === 1) {
                        var s_text = '<div><h2>Удалить запись '+id+' или перенести в архив ?</h2><hr/><p>Запись из архива можно в любой момент снова опубликовать.</p></div>';
                        buttons1 = new Object({
                                                'В архив': function () {
                                                        jQuery(this).dialog("close");
                                                        doDelete(id, 0);
                                                },
                                                'Удалить': function () {
                                                        jQuery(this).dialog("close");
                                                        doDelete(id, 1);
                                                },
                                                'Отменить': function () {
                                                        jQuery(this).dialog("close");
                                                }
                                            });
                    } else {
                        var s_text = '<div><h2>Удалить запись '+id+' из архива ?</h2><hr/><p>Запись из архива можно в любой момент снова опубликовать.</p></div>';
                        buttons1 = new Object({
                                                'Удалить': function () {
                                                        jQuery(this).dialog("close");
                                                        doDelete(id, 1);
                                                },
                                                'Отменить': function () {
                                                        jQuery(this).dialog("close");
                                                }
                                            });
                    }
                            jQuery('<div></div>').appendTo('body')
                                    .html(s_text)
                                    .dialog({
                                            modal: true,
                                            title: 'Удаление',
                                            zIndex: 10000,
                                            autoOpen: true,
                                            width: 'auto',
                                            resizable: false,
                                            buttons: buttons1,
                                            close: function (event, ui) {
                                                    jQuery(this).remove();
                                            }
                                    });
                    }

                    function doDelete(id, is_delete) {
                            var data = {
                                    'action': 'tzs_delete_shipment',
                                    'id': id,
                                'is_delete': is_delete
                            };

                            jQuery.post(ajax_url, data, function(response) {
                                    if (response == '1') {
                                            location.reload();
                                    } else {
                                            alert('Не удалось удалить: '+response);
                                    }
                            });
                    }
                    </script>
                    <?php 
                build_pages_footer($page, $pages);
            }
        }
    }
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Example #12
0
$sorting_script = true;
include 'header.php';
include 'access.php';
$access = checkAccess('a');
if ($access) {
    echo "<h2>" . T_("Settings") . " -- " . T_("Online Users") . "</h2>";
    echo "<p>" . sprintf(T_("You can see a list of users who have been active in the past %s minutes"), ONLINE_TIMEOUT / 60) . ".</p>\n";
    include 'conn.php';
    $Query = "select name, LastActivity as formatted_time from " . TABLE_PREFIX . "session where " . DATE_DIFF_SQL . " LastActivity) < " . ONLINE_TIMEOUT . " and status <> 'disabled' order by LastActivity";
    $dbResult = $dblink->query($Query);
    //echo($Query . "<br>");
    $count = 0;
    while ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
        if ($count == 0) {
            echo "<div class=\"content\"><table class='sortable'>\n<thead><tr><th>" . T_("User") . "</th><th>" . T_("Last Activity") . "</th></tr></thead><tbody>\n";
            require_once 'includes/convert_date.php';
        }
        $user_rec = "{$row["name"]}";
        $date1 = "{$row["formatted_time"]}";
        $date2 = convert_date($date1);
        echo "<tr><td><a href=\"userb.php?uname=" . $user_rec . "\">" . $user_rec . "</a></td><td>" . $date2 . "</td></tr>\n";
        $count++;
    }
    if ($count == 0) {
        echo "<p>" . sprintf(T_("No users have been active in the past %s minutes"), ONLINE_TIMEOUT / 60) . ".</p>\n";
    } else {
        echo "</tbody></table></div>\n";
    }
    echo "<p><a href=\"controlpanel.php\"><< " . T_("Back to Settings") . "</a></p>";
}
include 'footer.php';
Example #13
0
     $page['match'][$i]['team_visitor'] = $ligne['team_visitor_name'];
 }
 if ($ligne['team_home_name'] != NULL) {
     $page['match'][$i]['team_home'] = $ligne['team_home_name'];
 }
 $page['match'][$i]['sex_visitor'] = $ligne['sex_visitor_name'];
 $page['match'][$i]['sex_home'] = $ligne['sex_home_name'];
 $page['match'][$i]['sex_visitor_abbreviation'] = $ligne['sex_visitor_abbreviation'];
 $page['match'][$i]['sex_home_abbreviation'] = $ligne['sex_home_abbreviation'];
 $page['match'][$i]['competition'] = $ligne['competition_id'];
 $page['match'][$i]['competition_name'] = $ligne['competition_name'];
 $page['match'][$i]['field_state'] = $ligne['field_state_id'];
 $page['match'][$i]['field'] = $ligne['field_id'];
 $page['match'][$i]['weather'] = $ligne['weather_id'];
 $page['match'][$i]['date'] = convert_date($ligne['match_date'], $lang['match']['format_date_php']);
 $page['match'][$i]['hour'] = convert_date($ligne['match_date'], $lang['match']['format_hour_php']);
 if ($page['match'][$i]['hour'] == "00:00") {
     $page['match'][$i]['hour'] = "";
 }
 $page['match'][$i]['score_visitor'] = $ligne['match_score_visitor'];
 $page['match'][$i]['score_home'] = $ligne['match_score_home'];
 $page['match'][$i]['spectators'] = $ligne['match_spectators'];
 $page['match'][$i]['comment'] = $ligne['match_comment'];
 if ($tmp_date != $page['match'][$i]['date']) {
     $page['match'][$i]['show_date'] = '1';
 } else {
     $page['match'][$i]['show_date'] = '';
 }
 $tmp_date = $page['match'][$i]['date'];
 $page['match'][$i]['L_details'] = $lang['match']['show_view'];
 $page['match'][$i]['L_edit'] = $lang['match']['edit'];
Example #14
0
 public static function convert_date($original_date, $new_format = '')
 {
     $original_date = convert_date($original_date, 'Y-m-d H:i:s');
     $original_date = str_replace('-', '/', $original_date);
     return date_i18n($new_format, strtotime($original_date));
 }
Example #15
0
function test($s)
{
    echo "<br>{$s} --> " . convert_date($s);
}
 public static function Get_account_breakdown($start_date, $end_date, $account_id, &$account_list)
 {
     $account_list = array();
     $error = '';
     // convert dates into mysql dates
     $start_sql = convert_date($start_date, 1);
     $end_sql = convert_date($end_date, 1);
     if ($account_id < 0) {
         return 'You must enter a correct account id';
     } elseif ($start_sql == '') {
         return 'Start date is invalid.';
     } elseif ($end_sql == '') {
         return 'End date is invalid.';
     }
     $sql = "SELECT sum( ledger_amount ) AS total_amount, " . "  coalesce( a2.account_id, a.account_id ) as account_id, " . "  min( coalesce( a2.account_name, a.account_name ) ) as name " . "FROM Ledger_Entries le \n" . "INNER JOIN Transactions t ON t.trans_id = le.trans_id \n" . "INNER JOIN Accounts a ON le.account_id = a.account_id \n" . "LEFT  JOIN Accounts a2 ON a.account_parent_id = a2.account_id " . "  AND a2.account_id <> :account_id \n" . "WHERE ( a.account_parent_id= :account_id " . "  OR a2.account_parent_id= :account_id OR a.account_id = :account_id ) \n" . "  AND t.accounting_date >=  :start_sql " . "  AND t.accounting_date <=  :end_sql \n" . "GROUP BY coalesce( a2.account_id, a.account_id ) \n" . "ORDER BY total_amount DESC ";
     $pdo = db_connect_pdo();
     $ps = $pdo->prepare($sql);
     $ps->bindParam(':account_id', $account_id);
     $ps->bindParam(':start_sql', $start_sql);
     $ps->bindParam(':end_sql', $end_sql);
     $success = $ps->execute();
     if (!$success) {
         return get_pdo_error($ps);
     }
     // account_list (account_name, account_total, account_id)
     while ($row = $ps->fetch(PDO::FETCH_ASSOC)) {
         $account_list[$row['account_id']] = array($row['name'], $row['total_amount'], $row['account_id']);
     }
     $pdo = null;
     return $error;
 }
 value="1" style="margin-top: 5px;"></input></dt>
						
					</dl>
						
				</fieldset>
			</div>
			<div style="display: inline-block; float: left">
				<fieldset>
					<legend>date administrative</legend>
					<dl>
						<dt><label class="label" style="vertical-align: top; padding-top: 5px;">detalii</label><textarea class="standard" style="min-height: 73px;"  name="ClDetalii" ><?php 
echo $client->Detalii;
?>
</textarea></dt>
						<dt><label class="label">data actualizare</label><input type="text" name="ClDataActualizare" id="dataactualizare" value="<?php 
echo convert_date($client->DataActualizare);
?>
"></input>
							<input type="button" id="calendar-trigger" value='...'/><br/>
							<script>
			    				var cal1=Calendar.setup({onSelect:function(){cal1.hide();}});
			    				cal1.manageFields("calendar-trigger", "dataactualizare", "%d/%m/%Y");
							</script>
						</dt>
						<dt>
							<label class="label">agent</label><select name='ClidUtilizator' class="standard">
								<?php 
$userlist = User::find_all();
foreach ($userlist as $agent) {
    echo "<option ";
    if ($agent->id == $client->idUtilizator) {
Example #18
0
    $ligne = sql_fetch_array($res);
    sql_free_result($res);
    sql_close($sgbd);
    $page['value_idurl'] = $ligne['news_idurl'];
    $page['value_subhead'] = $ligne['news_subhead'];
    $page['value_title'] = $ligne['news_title'];
    $page['value_subtitle'] = $ligne['news_subtitle'];
    $page['value_summary'] = $ligne['news_summary'];
    $page['value_summary'] = stripslashes($ligne['news_summary']);
    $page['value_text'] = $ligne['news_text'];
    $page['value_text'] = stripslashes($ligne['news_text']);
    $page['value_ps'] = $ligne['news_ps'];
    $page['value_keyword'] = $ligne['news_keyword'];
    $page['value_status'] = $ligne['news_status'];
    $page['value_release'] = convert_date($ligne['news_release'], $lang['news']['format_date_form']);
    $page['value_release_time'] = convert_date($ligne['news_release'], $lang['news']['format_time_form']);
    if ($page['value_release_time'] == '00:00') {
        $page['value_release_time'] = '';
    }
}
/* status */
$page['status']['0']['id'] = "0";
$page['status']['0']['name'] = $lang['news']['supprime'];
$page['status']['0']['selected'] = "";
$page['status']['1']['id'] = "1";
$page['status']['1']['name'] = $lang['news']['en_attente'];
$page['status']['1']['selected'] = "";
$page['status']['2']['id'] = "2";
$page['status']['2']['name'] = $lang['news']['valid'];
$page['status']['2']['selected'] = "";
if ($page['value_status'] == "0") {
Example #19
0
        $count++;
    }
    /*while ( $b > 0 )  { 
    
                           $keys2 = array_rand($pictures, 1);
                           $img2  = "$dir_thumbs/$pictures[$keys2]";
       
                           $imgsize2 = getimagesize($img2); 
    
                           if ($imgsize2[1] <= 90) $b = 0;
    
                   }*/
    unset($gallery);
}
/******************************************/
$result["date_formatted"] = convert_date($result["date_formatted"], '');
if ($module != 'admin' && $lang_active == 'EN') {
    $result[title] = $result[title_EN];
}
if ($module != 'admin' && $lang_active == 'EN') {
    $result[description] = $result[description_EN];
}
if ($module != 'admin') {
    $result[description] = nl2br($result[description]);
}
if (isset($save_pages)) {
    $tpl->assign("array_p", $save_pages);
    $lastpage = end($save_pages);
    $tpl->assign("pagesT", $lastpage['page']);
    $tpl->assign("title_pagenavi", $gal_navi);
}
Example #20
0
 /**
  * Get the list of employees that have filed overtime within a specified 
  * date range.
  * 
  * @param string $employeenumber
  * @param string $datestart
  * @param string $dateend
  * @return mixed
  */
 public function filed_overtime($employeenumber, $startdate, $enddate)
 {
     $subordinates = $this->_ci->employeelogs->filed_overtime($employeenumber, $startdate, $enddate);
     $tabledata = array();
     $params = array('header' => $this->_filedot, 'class' => array('table table-striped table-bordered dt-table'));
     $this->_ci->load->library('MY_table', $params, 'subordinate_list');
     if (isset($subordinates) && !empty($subordinates)) {
         for ($i = 0; $i < count($subordinates); $i++) {
             $tabledata[] = array($this->_ot_modal($subordinates[$i]->UserlogID, "filedot/viewfiledovertime?logid=" . $subordinates[$i]->UserlogID), $subordinates[$i]->FirstName, $subordinates[$i]->LastName, convert_date($subordinates[$i]->TimeIn, "M d, Y h:i A"), convert_date($subordinates[$i]->Timeout, "M d, Y h:i A"), convert_date($subordinates[$i]->AuditDate, "M d, Y"), $this->_ot_status($subordinates[$i]));
         }
         if (isset($tabledata) && !empty($tabledata)) {
             return $this->_ci->subordinate_list->generate($tabledata);
         } else {
             return $this->_ci->subordinate_list->generate();
         }
     } else {
         return $this->_ci->subordinate_list->generate();
     }
 }
function sync_health_details($uid, $program, $pxid, $arr_tablet, $ccdev_id)
{
    $arr_conflict_data = array();
    $q_consult_id = mysql_query("SELECT consult_id FROM m_consult ORDER by consult_id DESC") or die("Cannot query 420: " . mysql_error());
    list($consult_id) = mysql_fetch_array($q_consult_id);
    $consult_id = $consult_id + 1;
    $insert_made = 0;
    $userid = 1;
    switch ($program) {
        case 'Expanded Program for Immunization':
            $get_value_to_match = mysql_query("SELECT db_table, emr_field_name, tablet_field_name, value_to_match FROM m_lib_mm_data_map WHERE question_id='{$program}' AND value_to_match!=''") or die("Cannot query 421: " . mysql_error());
            while (list($db_table, $emr_field_name, $tablet_field_name, $value_to_match) = mysql_fetch_array($get_value_to_match)) {
                $field_name_to_compare = $db_table == 'm_consult_ccdev_vaccine' ? 'vaccine_id' : 'service_id';
                $field_date = $db_table == 'm_consult_ccdev_vaccine' ? 'actual_vaccine_date' : 'ccdev_service_date';
                $q_health_data = mysql_query("SELECT " . $emr_field_name . " FROM " . $db_table . " WHERE " . $field_name_to_compare . "='" . $value_to_match . "' AND patient_id='" . $pxid . "'") or die("Cannot query 425: " . mysql_error());
                if (mysql_num_rows($q_health_data) == 0) {
                    //the vaccine_id/service_id not seen, insert the ID
                    //echo $db_table.'/'.$emr_field_name.'/'.$tablet_field_name.'/'.$value_to_match."<br>";
                    $date_given = convert_date($arr_tablet[$tablet_field_name]);
                    if ($date_given != "0000-00-00") {
                        $str_sql = "INSERT INTO " . $db_table . " SET " . $field_date . "='" . $date_given . "', consult_id='" . $consult_id . "',user_id='" . $userid . "',patient_id='" . $pxid . "', " . $field_name_to_compare . "='" . $value_to_match . "',ccdev_id='" . $ccdev_id . "'";
                        //echo $str_sql."<br><br>";
                        $q_insert_health_data = mysql_query($str_sql) or die("Cannot query 440: " . mysql_error());
                        $q_insert_vaccine = mysql_query("INSERT INTO m_consult_vaccine SET consult_id='{$consult_id}',patient_id='{$pxid}',user_id='{$userid}',vaccine_timestamp=NOW(),actual_vaccine_date='{$date_given}',source_module='ccdev',adr_flag='N',vaccine_id='{$value_to_match}'") or die("Cannot query 529: " . mysql_error());
                        $insert_made = 1;
                    } else {
                    }
                } else {
                    list($emr_date_value) = mysql_fetch_array($q_health_data);
                    if ($emr_date_value != '0000-00-00') {
                        $tablet_date = convert_date($arr_tablet[$tablet_field_name]);
                        if ($emr_date_value != $tablet_date) {
                            //conflicting data, allow the user to select
                            array_push($arr_conflict_data, array($db_table, $field_name_to_compare, $emr_date_value, $tablet_date, $value_to_match, $field_date, $tablet_field_name));
                        }
                    }
                }
            }
            if ($insert_made == 1 && !empty($_GET["uid"])) {
                $healthcenter_id = $_SESSION["datanode"]["code"];
                $q_insert_consult = mysql_query("INSERT INTO m_consult SET consult_id='{$consult_id}',patient_id='{$pxid}',user_id='{$userid}',healthcenter_id='{$healthcenter_id}',consult_timestamp=NOW(),consult_end=NOW(),consult_date=NOW(),see_doctor_flag='N'");
                echo "<script language='Javascript'>";
                echo "window.alert('The record for {$_GET['program']} was saved.')";
                echo "</script>";
                header("Location:" . $_SERVER["PHP_SELF"] . "?type={$_GET['type']}&title={$_GET['title']}&uid={$_GET['uid']}&program={$_GET['program']}&action={$_GET['action']}");
            } else {
                echo "<script language='Javascript'>";
                echo "window.alert('No update found for this client record for the {$_GET['program']}')";
                echo "</script>";
            }
            if (count($arr_conflict_data) != 0) {
                echo "<script language='Javascript'>";
                echo "window.alert('There was a data conflict identified. Select whether to save the mobile device or the EMR value.')";
                echo "</script>";
                display_conflict_date($arr_conflict_data, $uid, $pxid);
            }
            break;
        default:
            break;
    }
}
Example #22
0
    while ($row_latest = mysql_fetch_array($result_latest)) {
        ?>
  
  <div class="post">
  <h2>
  <a href="index.php?page=single&amp;post_id=<?php 
        echo $row_latest['post_id'];
        ?>
">
  <?php 
        echo $row_latest['title'];
        ?>
</a></h2>
  
  <div class="meta"><span class="date"><?php 
        echo convert_date($row_latest['date']);
        ?>
</span><span class="cat"> in category <?php 
        echo $row_latest['name'];
        ?>
</span></div><!--END meta-->
  <div class="entry"><?php 
        echo $row_latest['body'];
        ?>
  </div><!--END ENTRY-->
  <hr />
  </div> <!--END POST-->
  <?php 
    }
    //end --while-- loop
} else {
Example #23
0
 function login($username, $pass, $passEncrypted = false)
 {
     global $SETTINGS;
     /*
     	$resultArr['message'] : the message displaying either the error or success, used with p class ("error"/"success")
     	$resultArr['optmessage'] : the message explaining more in details the error
     	$resultArr['success'] : the bool saying whether or not the login was successfull
     	$resultArr['username'] : the "real" username of the user
     */
     $resultArr = array();
     $resultArr['success'] = false;
     include $SETTINGS['path_mod'] . 'conn.php';
     if ($username != null && $pass != null) {
         require_once $SETTINGS['path_mod'] . 'includes/protection.php';
         //Check if the name and pass strings are valid (for protection)
         if (!(valid($username, 20) && valid($pass, 50))) {
             $resultArr['message'] = T_("Please check your username and password and make sure that they are correctly spelled.");
         } else {
             //Check if the name exists on the database
             $Query = sprintf("select name from " . TABLE_PREFIX . "session where name=%s", quote_smart($username));
             //echo($Query . "<br>\n");
             $dbResult = $dblink->query($Query);
             if ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
                 //Check if user is demo, to avoid blocking the account
                 $democheck = strtoupper($username);
                 $logtries = 0;
                 if ($democheck != "DEMO") {
                     //Check if user is connecting more than 3 times
                     $Query = sprintf("select success from " . TABLE_PREFIX . "loginhits where name=%s and " . DATE_DIFF_SQL . " time) < " . WAITTIME . " order by time", quote_smart($username));
                     //echo($Query . "<br>\n");
                     $dbResult = $dblink->query($Query);
                     $success = 'N';
                     while ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
                         $success = "{$row["success"]}";
                         if ($success == 'N') {
                             $logtries++;
                         }
                     }
                     if ($success == 'Y') {
                         $logtries = 0;
                     }
                 }
                 //Check if user tried more than 3 times
                 if ($logtries < 3) {
                     //Encrypt password if not already
                     if (!$passEncrypted) {
                         $passencrypt = $this->encryptPassword($pass);
                     } else {
                         $passencrypt = $pass;
                     }
                     // Make a safe query
                     $Query = sprintf("select name, status from " . TABLE_PREFIX . "session where name=%s and pass=%s", quote_smart($username), quote_smart($passencrypt));
                     //echo($Query);
                     $dbResult = $dblink->query($Query);
                     if ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
                         $status = "{$row["status"]}";
                         $realname = "{$row["name"]}";
                         //Check if user is activated, if not an admin
                         if ($status != "admin" && $democheck != "DEMO") {
                             $Query = "select name, activated from " . TABLE_PREFIX . "activation where (name='" . $username . "')";
                             //echo($Query . "<br>\n");
                             $dbResult = $dblink->query($Query);
                             $yesno = '';
                             if ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
                                 $yesno = "{$row["activated"]}";
                             }
                         }
                         if ($yesno == 'Y' || ($status == "admin" || $democheck == "DEMO")) {
                             $resultArr['success'] = true;
                             //Set the session variabless and return vars
                             $_SESSION['privInSession'] = "normal";
                             $_SESSION['nameInSession'] = $realname;
                             $this->usernameSession = $realname;
                             $resultArr['username'] = $realname;
                             //check if the user wants to be remember: set cookie
                             if (isset($_POST['remember'])) {
                                 setcookie("gbname", $realname, time() + 60 * 60 * 24 * 100, "/");
                                 setcookie("gbpass", $passencrypt, time() + 60 * 60 * 24 * 100, "/");
                             }
                             $resultArr['message'] = T_("Welcome back") . " <b>" . $realname . "</b>!";
                             $Query = "SELECT lastlog AS formatted_time, style from " . TABLE_PREFIX . "session where name='" . $username . "'";
                             //echo($Query . "<br>\n");
                             $dbResult = $dblink->query($Query);
                             if ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
                                 $date1 = "{$row["formatted_time"]}";
                                 require_once 'convert_date.php';
                                 $date2 = convert_date($date1, true);
                                 $resultArr['message'] .= " " . T_("Your last login was on") . " " . $date2;
                                 $style = "{$row["style"]}";
                             }
                             //Check user's browser and user's preference (to do)
                             include 'browser.php';
                             $br = new Browser();
                             $_SESSION['browser'] = $br->Name;
                             $browser = $_SESSION['browser'];
                             if ($browser == "MSIE") {
                                 $browser = "Internet Explorer";
                             }
                             $_SESSION['layoutInSession'] = "no_js";
                             $_SESSION['styleInSession'] = "";
                             if ($style == "Auto") {
                                 if ($browser == "Internet Explorer") {
                                     $_SESSION['styleInSession'] = "IE";
                                 } else {
                                     if ($browser == "Opera") {
                                         $_SESSION['styleInSession'] = "Opera";
                                     } else {
                                         $_SESSION['styleInSession'] = "Firefox";
                                     }
                                 }
                             } else {
                                 $_SESSION['styleInSession'] = $style;
                             }
                             $this->styleSession = $_SESSION['styleInSession'];
                             //Update last logging time
                             //$time = date('Y-m-d H:i:s');
                             $Query = "update " . TABLE_PREFIX . "session set LastLog = now(), LastActivity = now() where name='" . $username . "'";
                             $dbResult = $dblink->query($Query);
                             //Check for user's privileges
                             $Query = "select status from " . TABLE_PREFIX . "session where name='" . $username . "'";
                             $dbResult = $dblink->query($Query);
                             //echo($Query . "<br>\n");
                             $found = false;
                             $priv = "";
                             if ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
                                 $priv = "{$row["status"]}";
                                 $found = true;
                             }
                             // TODO: Please change the following emails below
                             $loginSuccess = 'Y';
                             if ($found && $priv == "admin") {
                                 $_SESSION['privInSession'] = "admin";
                             } else {
                                 if ($found && $priv == "disabled") {
                                     $_SESSION['privInSession'] = "disabled";
                                     $resultArr['success'] = false;
                                     $_SESSION['nameInSession'] = null;
                                     $this->usernameSession = null;
                                     $resultArr['username'] = null;
                                     $resultArr['message'] = T_("Your account has been disabled") . ".";
                                     $loginSuccess = 'D';
                                     $resultArr['optmessage'] = sprintf(T_("This has been done by our anti-spam system. If you think it is a mistake, please email <a href=\"%s\">%s</a>.<br>\n<i>Expect 1-2 days of response by email</i>"), "mailto:support@getboo.com", "*****@*****.**");
                                 } else {
                                     $_SESSION['privInSession'] = "normal";
                                 }
                             }
                             $this->privSession = $_SESSION['privInSession'];
                             // Update loginhits table
                             $Query = "\r\n\t\t\t\t\t\t\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "loginhits\r\n\t\t\t\t\t\t\t\t\t\t\t(Name, Time, IP, Success)\r\n\t\t\t\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t\t\t\t('{$realname}', now(), '" . $_SERVER['REMOTE_ADDR'] . "', '{$loginSuccess}')\r\n\t\t\t\t\t\t\t\t\t\t\t";
                             $dbResult = $dblink->query($Query) or die("Couldn't update the database");
                         } else {
                             $resultArr['message'] = T_("Your account is not activated") . ".";
                             $resultArr['optmessage'] = "" . sprintf(T_("You must first <a href=\"%s\">activate</a> your account with the code emaild to you when you registered"), "activate.php") . ".<br>\n " . sprintf(T_("Please check your email in order to get your activation code<br>\n or email <a href=\"%s\">%s</a> if you don't receive any email from us after 24h"), "mailto:registration@getboo.com", "*****@*****.**") . ".<br>\n<i>" . T_("Expect 1-2 days of response by email") . "</i>";
                         }
                     } else {
                         $resultArr['message'] = T_("The password is invalid") . ".";
                         if ($democheck != "DEMO") {
                             //$time = date('Y-m-d H:i:s');
                             $Query = "\r\n\t\t\t\t\t\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "loginhits\r\n\t\t\t\t\t\t\t\t\t\t(Name, Time, IP, Success)\r\n\t\t\t\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t\t\t\t('{$username}', now(), '" . $_SERVER['REMOTE_ADDR'] . "', 'N')\r\n\t\t\t\t\t\t\t\t\t\t";
                         }
                         $dbResult = $dblink->query($Query);
                     }
                 } else {
                     $resultArr['message'] = T_("Too many login tries") . ".";
                     $resultArr['optmessage'] = sprintf(T_("You have tried to log in more than 3 times unsuccessfully for this account in the last %s minutes"), WAITTIME / 60) . ".<br><br>" . sprintf(T_("Please try again in %s minutes"), WAITTIME / 60) . ".";
                 }
             } else {
                 $resultArr['message'] = T_("The user does not exist") . ".";
             }
         }
     } else {
         $resultArr['message'] = T_("Username or Password is missing") . "";
     }
     return $resultArr;
 }
Example #24
0
$match_field_num = array();
// numero des colonnes correspondants
# required for step 4 : we need existing matchs list
$match_list = array();
//if($page['value_step']=='validation') {
$var['condition'] = " ";
$var['order'] = " ORDER BY m.match_date DESC ";
$var['limit'] = " ";
$sql_match = sql_replace($sql['match']['select_match_condition'], $var);
$sgbd = sql_connect();
$res_match = sql_query($sql_match);
$nb_ligne = sql_num_rows($res_match);
if ($nb_ligne != "0") {
    while ($ligne = sql_fetch_array($res_match)) {
        $id = $ligne['match_id'];
        $match_list[$id] = convert_date($ligne['match_date'], $lang['match']['format_date_form']) . " " . convert_date($ligne['match_date'], $lang['match']['format_hour_form']) . " : ";
        if ($ligne['club_home_abbreviation'] != '') {
            $match_list[$id] .= $ligne['club_home_abbreviation'];
        } else {
            $match_list[$id] .= $ligne['club_home_name'];
        }
        if ($ligne['team_home_name'] != '') {
            $match_list[$id] .= ' ' . $ligne['team_home_name'];
        }
        if ($ligne['sex_home_abbreviation'] != '') {
            $match_list[$id] .= ' [' . $ligne['sex_home_abbreviation'] . '] ';
        }
        $match_list[$id] .= ' - ';
        if ($ligne['club_visitor_abbreviation'] != '') {
            $match_list[$id] .= $ligne['club_visitor_abbreviation'];
        } else {
Example #25
0
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
***************************************************************************/
include 'header.php';
include 'access.php';
$access = checkAccess();
if ($access) {
    include 'sbheader.php';
    include 'includes/convert_date.php';
    echo "<b>" . T_("Stats") . " -- " . T_("Searches") . "</b><br><br>\n";
    $Query = "select keyword, count(*) as Count, max(time) as Time from " . TABLE_PREFIX . "searches s where s.name='{$username}' group by keyword order by Count desc";
    //echo($Query . "<br>\n");
    $dbResult = $dblink->query($Query);
    $count = 0;
    while ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
        if ($count == 0) {
            echo "<table><tr><td><u>" . T_("Keyword") . "</u></td><td><u>" . T_("Count") . "</u></td><td><u>" . T_("Last Search Date") . "</u></td></tr>\n";
        }
        $keyword = "{$row["keyword"]}";
        $count = "{$row["count"]}";
        $time = "{$row["time"]}";
        $time2 = convert_date($time);
        echo "<tr><td>{$keyword}</td><td>{$count}</td><td>{$time2}</td></tr>\n";
        $count++;
    }
    echo "</table>";
    if ($count == 0) {
        echo '<p class="notice">' . T_("No searches") . '</p>';
    }
    echo "</div>";
}
include 'footer.php';
Example #26
0
    </div>
</div>
<div class="modal-body">
    <?php 
echo form_open($action = site_url('leaves/update'), $attributes = array('id' => 'updateleave', 'name' => 'updateleave', 'role' => 'form'));
?>
        <?php 
echo form_hidden(array('leaveid' => $leave->LeaveID, 'employeenumber' => $leave->EmployeeNumber));
?>
        <h6>From:</h6>
        <?php 
echo form_input(array('name' => 'leavefrom', 'id' => 'leavefrom', 'data-date-format' => 'yyyy-mm-dd', 'class' => 'form-control date-picker'), convert_date($leave->LeaveFrom, "Y-m-d"), 'required');
?>
        <h6>To:</h6>
        <?php 
echo form_input(array('name' => 'leaveto', 'id' => 'leaveto', 'data-date-format' => 'yyyy-mm-dd', 'class' => 'form-control date-picker'), convert_date($leave->LeaveTo, "Y-m-d"), 'required');
?>
        <h6>Type:</h6>
        <?php 
echo form_dropdown('leavetypes', $leavetypes, $leavedescription[trim($leave->Type)], 'class="form-control" id="leavetypes"');
?>
        <h6>Reason:</h6>
        <?php 
echo form_textarea(array('name' => 'leavereason', 'id' => 'leavereason', 'rows' => '7', 'class' => 'form-control'), $leave->Reason, 'required');
?>
        
        <h6>Status: <strong><em><?php 
echo leave_status($leave);
?>
</em></strong></h6>
        <?php 
Example #27
0
 /**
  * Update employee leave credits. But we'll need to loop through the 
  * dates to check if one (or all) the dates fall on a holiday. If the 
  * date fall on a holiday we'll need to exclude it from the leave 
  * credits deduction.
  * 
  * @param string $employeenumber
  * @param string $leavetype
  * @param date $start
  * @param date $end
  * @return void
  */
 public function updatecredits($employeenumber, $leavetype, $start, $end)
 {
     $days = days_difference($start, $end);
     $holidays = 0;
     // We'll loop through the days.
     for ($i = 0; $i < $days; $i++) {
         if ($this->_ci->holidays->checkholiday(convert_date(date_subtract($i, date_create($end)), 'Y-m-d'))) {
             $holidays++;
         }
     }
     $this->_ci->employeeleaves->load($employeenumber);
     $leavecoltype = substr($leavetype, 0, strpos($leavetype, ' '));
     $remainingcredits = $this->_ci->employeeleaves->{$leavecoltype} - ($days - $holidays);
     $this->_ci->employeeleaves->update_leave_count($employeenumber, $leavecoltype, $remainingcredits, $this->_ci->session->userdata('employeenumber'));
 }
Example #28
0
            $tpl->assign('happier_in_past', $score_interpretation['happier_in_past']);
        }
    }
    $time_since_last_entry = time() - $latest_entrydate;
    $in_days = round($time_since_last_entry / 60 / 60 / 24);
    //check time ban
    $repeat_in_days = bd_min_waittime * 24 * 60 * 60;
    if ($time_since_last_entry < $repeat_in_days) {
        $tpl->assign('time_ban', 1);
    }
    $tpl->assign('score_interpretation_latest', get_score_interpretation('latest', intval($latest_score), $score_interpretation));
    require_once './lib/functions/convert_date.php';
    //format dates for select box
    foreach ($bd_scale_dates as $key => $value) {
        $select_dates[] = $value["date"];
        $select_dates_formatted[] = convert_date($value["date"], 1, $getmonth);
    }
    $tpl->assign('in_days', $in_days);
    $tpl->assign('latest_score', $latest_score);
    $tpl->assign('change', $change);
    $tpl->assign('select_dates', $select_dates);
    $tpl->assign('select_dates_formatted', $select_dates_formatted);
    $tpl->assign('getmonth', serialize($getmonth));
}
//fill template variables
$tpl->assign('head_title', $head_title['analyze']['bd_scale']['index']);
$tpl->assign('head_subtitle', $head_subtitle['analyze']['bd_scale']['index']);
$tpl->assign('datay', $bd_scale_data);
$tpl->assign('total_entries', $total_entries);
$tpl->assign('max_items_bd_scale', max_items_bd_scale);
$tpl->assign('repeat_in_days', bd_min_waittime);
Example #29
0
 if (empty($_GET['dob'])) {
     echo 'Error: You must enter a date of birth.';
     exit(1);
 }
 $first = !empty($_GET['first']) ? append_quotes($_GET['first']) : 'NULL';
 $last = !empty($_GET['last']) ? append_quotes($_GET['last']) : 'NULL';
 $sex = !empty($_GET['sex']) ? append_quotes($_GET['sex']) : 'NULL';
 $dod = !empty($_GET['dod']) ? $_GET['dod'] : 'NULL';
 if ($dod != 'NULL') {
     if ($dob > $dod) {
         echo 'Error: A person cannot die before they are born!';
         exit(1);
     }
     $dod = convert_date($dod);
 }
 $dob = convert_date($dob);
 $db_connection = connect_db();
 $id_query = 'select max(id) from MaxPersonID';
 $rs = mysql_query($id_query);
 if (!$rs) {
     echo 'MySQL Error.';
     exit(1);
 }
 $id = mysql_fetch_row($rs)[0];
 // echo "<br>$id $first $last $sex $dob $dod"; //debug
 if ($type == 'Actor') {
     $query = "insert into Actor(id, last, first, sex, dob, dod) values ({$id}, {$last}, {$first}, {$sex}, {$dob}, {$dod})";
     $rs = mysql_query($query);
     if (!$rs) {
         echo 'MySQL Error.';
         exit(1);
Example #30
0
<?php

/* XAJAX - asynchronous call: retrieve updated data */
require_once 'lib/functions/convert_date.php';
$goals = new SelectEntrys();
$goals->cols = "ID, goal, progress, created, achieved";
$goals->table = $tbl_goals;
$goals->condition = " userID = '" . $user_data['ID'] . "' ";
if (!isset($goals_order)) {
    $goals->order = 'created DESC';
} else {
    $goals->order = $goals_order;
}
if (isset($goals_show_landing) == true) {
    $goals->limit = 1;
}
//$goals->limit     = 10;
$goals->multiSelect = 1;
$ay_goals = $goals->row();
$count = 0;
if (isset($ay_goals[0])) {
    foreach ($ay_goals as $res2) {
        $ay_goals[$count]["created"] = convert_date($res2["created"], 0, $getmonth);
        $ay_goals[$count]["achieved"] = convert_date($res2["achieved"], 0, $getmonth);
        $count++;
    }
}