Beispiel #1
0
 while ($counter <= $count) {
     echo "<item>\n";
     echo "<title>";
     // parse title
     $end = '</b></a></font></td>';
     $title = get_title($content[$counter], $end);
     $content[$counter] = get_rest($content[$counter], $end);
     echo strip_tags($title);
     // end parse
     echo "</title>\n";
     echo "<pubDate>\n";
     // parse date & time
     $start = '<nobr>';
     $end = '</a></nobr></font></td>';
     $datetime = get_string($content[$counter], $start, $end);
     $content[$counter] = get_rest($content[$counter], $end);
     // get date
     //		$start = "[";
     //		$end = ":";
     //		$date = substr(get_string($datetime,$start,$end),0,10);
     // get date & time separately
     $start = "[";
     $end = ".";
     $datetime = get_string($datetime, $start, $end);
     $datetime = explode(" ", $datetime);
     $date = explode("-", $datetime[0]);
     $time = explode(":", $datetime[1]);
     //		echo $time[0]."-".$time[1]."-".$time[2];
     // HÄR ÄNDRADE JAG!! G>H
     //		$dejt = gmdate ("D, j M Y G:i:s \G\M\T",mktime(0,0,0,1,9,2003);
     echo gmdate("D, j M Y H:i:s \\G\\M\\T", mktime($time[0], $time[1], $time[2], $date[1], $date[2], $date[0]));
Beispiel #2
0
function show_contact()
{
    $user = $GLOBALS['user'];
    $user_id = (int) $_GET['contact'];
    //НАЧАЛО: Обновление статуса
    if (isset($_POST['status'])) {
        $post_status = $_POST['status'];
        db_query("UPDATE `phpbb_profile_fields_data` SET `pf_status`='{$post_status}' WHERE `user_id`={$user_id}");
        $status_update_message = template_get('message', array('message' => "Статус успешно обновлен"));
    } else {
        $status_update_message = "";
    }
    //КОНЕЦ: Обновление статуса
    $posts_number = db_easy_count("SELECT * FROM `phpbb_posts` WHERE `poster_id`={$user_id}");
    $topics_number = db_easy_count("SELECT * FROM `phpbb_topics` WHERE `topic_poster`={$user_id}");
    $contact = db_easy("SELECT * FROM `phpbb_users` WHERE `user_id`={$user_id}");
    $status = db_easy("SELECT * FROM `phpbb_profile_fields_data` WHERE `user_id`={$user_id}");
    $point = db_easy("SELECT * FROM `phpbb_points` WHERE `id`={$contact['point_id']}");
    $mobilephones_html = "";
    if ($contact['user_workmobilephone'] != "") {
        $mobilephones_html .= "<tr><td>Мобильный телефон (рабочий)</td><td>{$contact['user_workmobilephone']}</td>";
    }
    if ($contact['user_privatemobilephone'] != "") {
        $mobilephones_html .= "<tr><td>Мобильный телефон (личный)</td><td>{$contact['user_privatemobilephone']}</td>";
    }
    //
    if (check_rights('show_hidden_contacts')) {
        $contact['user_type'] == 9 ? $sql_hidden_contacts = "OR `user_type`=9" : ($sql_hidden_contacts = "");
    }
    //Мой руководитель
    if ($contact['mychief_id'] != 0) {
        $mychief = db_easy("SELECT * FROM `phpbb_users` WHERE `user_id`={$contact['mychief_id']}");
        $mychief_html = "<tr><td>Руководитель:</td><td><a href='/manager.php?action=show_contact&contact={$contact['mychief_id']}'>{$mychief['username']}</a></td></tr>";
    } else {
        $mychief_html = "";
    }
    //Мои подчиненные
    $employeesRES = db_query("SELECT * FROM `phpbb_users` WHERE `mychief_id`={$user_id} AND `user_type` IN (0,3) ORDER BY `username` ASC");
    if (db_count($employeesRES) > 0 && $contact['chief'] == 1) {
        $employees_html = "<tr><td valign='top'>Подчиненные:</td><td>";
        while ($employee = db_fetch($employeesRES)) {
            $employees_html .= "<a href='/manager.php?action=show_contact&contact=" . $employee['user_id'] . "'>" . $employee['username'] . "</a><br/>";
        }
        $employees_html .= "</td></tr>";
    } else {
        $employees_html = "";
    }
    if ($point['name'] == "" || $point['name'] == "--не определено--") {
        $point_html = "не определено";
    } else {
        $point_html = "<a href='/manager.php?action=show_point&point={$point['id']}'>{$point['name']}</a>";
    }
    if (check_rights('edit_contact')) {
        $edit_contact_html = "<a href='/manager.php?action=edit_contact&contact={$user_id}' style='font-size:8pt;'>Редактировать</a>";
    }
    if ($user->data['user_id'] == $user_id && !check_rights('edit_contact')) {
        $status_html = "<form action='/manager.php?action=show_contact&contact={$user_id}' method='post'>\r\n\t\t\t\t\t\t\t\t<input type='text' name='status' value='{$status['pf_status']}' style='width:350px;' /><br/>\r\n\t\t\t\t\t\t\t\t{$status_update_message}\r\n\t\t\t\t\t\t\t\t<input type='submit' value='Обновить'  style='margin:6px 0 0 0; width:80px;' />\r\n\t\t\t\t\t\t</form>";
    } else {
        $status_html = $status['pf_status'];
    }
    //НАЧАЛО: Переключатели "Следующий" и "Предыдущий"
    $previous_html = "";
    $next_html = "";
    $all_contactsRES = db_query("SELECT * FROM `phpbb_users`\r\n\t\t\t\t\t\t\t\tWHERE (`user_type`=0 OR `user_type`=3 {$sql_hidden_contacts}) AND `username`!='root'\r\n\t\t\t\t\t\t\t\t\tORDER BY `username`\r\n\t\t\t\t\t\t\t\t\t\t");
    $count_contacts = db_count($all_contactsRES);
    $i = 0;
    $all_contacts = array();
    while ($a_contact = db_fetch($all_contactsRES)) {
        $all_contacts[$i] = $a_contact['user_id'];
        if ($a_contact['user_id'] == $user_id) {
            $current = $i;
        }
        $i++;
    }
    $previous = $current;
    $next = $current;
    $previous_id = $user_id;
    $next_id = $user_id;
    if ($current > 0) {
        $previous = $current - 1;
        $previous_id = $all_contacts[$previous];
    }
    if ($current < $count_contacts - 1) {
        $next = $current + 1;
        $next_id = $all_contacts[$next];
    }
    //КОНЕЦ: Переключатели "Следующий" и "Предыдущий"
    /*НАЧАЛО: Учет рабочего времени*/
    if (($user->data['user_id'] == $user_id || $user->data['timetable_editor'] == 1 && $contact['my_timetable_editor_id'] == $user->data['user_id'] || check_rights('hr_manager')) && $contact['notimetable'] != 1) {
        /*Отпуск*/
        $vocations = get_days_str($user_id, date("Y"), 2);
        /*Больничный*/
        $bolnichny = get_days_str($user_id, date("Y"), 3);
        /*За свой счет*/
        $zasvoischet = get_days_str($user_id, date("Y"), 4);
        /*Командировка*/
        $travel = get_days_str($user_id, date("Y"), 5);
        $uchet_rabochego_vremeni = template_get("contacts/uchet_rabochego_vremeni", array('vocations_num' => $vocations['used'], 'vocations_rest' => get_rest($vocations['used_hours'], 20 * 8), 'vocations_str' => $vocations['when'], 'bolnichny_num' => $bolnichny['used'], 'bolnichny_rest' => get_rest($bolnichny['used_hours'], 5 * 8), 'bolnichny_str' => $bolnichny['when'], 'zasvoischet_num' => $zasvoischet['used'], 'zasvoischet_str' => $zasvoischet['when'], 'travel_num' => $travel['used'], 'travel_str' => $travel['when']));
    } else {
        $uchet_rabochego_vremeni = '';
    }
    /*КОНЕЦ: Учет рабочего времени*/
    $html .= template_get("contacts/show_contact", array('name' => $contact['username'], 'occupation' => $contact['user_occ'], 'email' => $contact['user_email'], 'skype' => $contact['user_skype'], 'officephone' => $point['phone'], 'extphone' => $contact['user_extphone'], 'mobilephones' => $mobilephones_html, 'status' => $status_html, 'point' => $point_html, 'editcontact' => $edit_contact_html, 'mychief' => $mychief_html, 'employees' => $employees_html, 'photo' => get_user_avatar($contact['user_avatar'], $contact['user_avatar_type'], $contact['user_avatar_width'], $contact['user_avatar_height']), 'posts_number' => $posts_number, 'previous' => "/manager.php?action=show_contact&contact={$previous_id}", 'next' => "/manager.php?action=show_contact&contact={$next_id}", 'current' => $current + 1 . " из " . $count_contacts, 'uchet_rabochego_vremeni' => $uchet_rabochego_vremeni));
    return $html;
}