Ejemplo n.º 1
0
 /** Hent oppgaver */
 private static function load($skip_cache = false)
 {
     // forsøk å hent fra cache
     if (!$skip_cache && !self::$cache) {
         self::$cache = cache::fetch("tasks");
     }
     // hent fra databasen
     if ($skip_cache || !self::$cache) {
         global $_base;
         $result = \Kofradia\DB::get()->query("SELECT t_name, t_ant, t_last FROM tasks");
         // les data
         self::$cache = array();
         while ($row = $result->fetch()) {
             self::$cache[$row['t_name']] = $row;
         }
         // lagre til cache
         cache::store("tasks", self::$cache);
     }
 }
Ejemplo n.º 2
0
 /**
  * Internt: Legg til en rapportering
  * @param int $up_id
  * @param int $type
  * @param int $type_id
  * @param string $message
  * @return int r_id
  */
 private static function add($up_id, $type, $type_id, $message)
 {
     global $__server;
     // sørg for at brukeren er logget inn
     if (!login::$logged_in) {
         throw new HSException("Brukeren er ikke logget inn.");
     }
     // samle sammen data
     $source_up_id = intval(login::$user->player->id);
     $up_id = intval($up_id);
     $type = intval($type);
     $type_id = intval($type_id);
     $message = \Kofradia\DB::quote($message);
     // legg til
     \Kofradia\DB::get()->exec("INSERT INTO rapportering SET r_source_up_id = {$source_up_id}, r_up_id = {$up_id}, r_type = {$type}, r_type_id = {$type_id}, r_time = " . time() . ", r_note = {$message}");
     $id = \Kofradia\DB::get()->lastInsertId();
     // melding på IRC
     putlog("CREWCHAN", "%bNY RAPPORTERING:%b {$__server['path']}/crew/rapportering");
     // øk rapporteringstelleren
     tasks::increment("rapporteringer");
     // returner iden
     return $id;
 }
                 echo '<div class="tasks_overdue" onclick=viewTask(' . $tid . ')>
                 <h3>' . $row["description"] . '<span class="days_overdue">  ' . $overdue . ' Day(s)</span></h3>
                 <p><span>Due: ' . $row['due_date'] . '</span><p>
                 </div>';
             }
             $row = $obj1->fetch();
             $tid = $row['task_id'];
         }
     } else {
         echo '<div class="tasks_overdue"><h3>No Tasks Overdue</h3></div>';
     }
     break;
 case 12:
     include_once 'tasks.php';
     $date = $_REQUEST['date'];
     $obj1 = new tasks();
     if ($isadmin) {
         $obj1->get_task_by_date($date);
     } else {
         $obj1->get_task_by_date_id($date, $user_id);
     }
     $row = $obj1->fetch();
     $tid = $row['task_id'];
     $i = 1;
     if ($tid != 0) {
         while ($row) {
             echo "<div class='cal_task'>" . $i . ":" . $row['description'] . "</div>";
             $i++;
             $row = $obj1->fetch();
         }
     } else {
Ejemplo n.º 4
0
// include '../view/header.php';
?>
        <?php 
// include '../view/promo.php';
?>
        
                  <!--body-->
        <div id="main">
            <?php 
// include '../view/news.php';
?>
            <div id="heart">
                <?php 
if (isset($_SESSION['userlogin']) && @$_SESSION['userlogin']) {
    include_once $_SERVER['DOCUMENT_ROOT'] . '/phptest/new_mvc/model/tasks.php';
    $tasks = new tasks();
    @($task_id = $_GET['task']);
    if (isset($task_id)) {
        echo "shit";
        try {
            $sql = $tasks->view_task($task_id);
            while ($rows_task = mysqli_fetch_array($sql)) {
                $task_userid = $rows_task['user_id'];
                $task_name = $rows_task['name'];
                $task_body = $rows_task['body'];
                $task_from = $rows_task['from'];
                $task_from_time = $rows_task['from_time'];
                $task_to = $rows_task['to'];
                $task_to_time = $rows_task['to_time'];
                $task_category_id = $rows_task['category_id'];
            }
Ejemplo n.º 5
0
 function gantt_vaccine($gantt_data)
 {
     $string .= "<chart manageResize='1'dateFormat='dd/mm/yyyy' outputDateFormat='ddds mns yy' ganttWidthPercent='40' canvasBorderColor='999999' canvasBorderThickness='0' gridBorderColor='4567aa' gridBorderAlpha='20' ganttPaneDuration='3' ganttPaneDurationUnit='m' ><categories  bgColor='009999'>";
     //gets the Initial date and end date from the table Shipments
     //stores them in the form of an array in the start variable
     //used to make the chart's date timeline
     $start = Vaccine_Shipments::get_Initial($gantt_data);
     //foreach statement cycles through the array $start
     foreach ($start as $starts) {
         //all the initial dates are stored in the array $strt
         $strt = $starts['date1'];
         //formats the initial dates in a proper format
         $start1 = date('d/m/Y', strtotime($strt));
         //stores the end date in a second variable and formats them accordingly
         $startz = $starts['date2'];
         $start2 = date('d/m/Y', strtotime($startz));
         $string .= "<category start='" . $start1 . "' end='" . $start2 . "'  label='Shipment of Vaccine Received'  fontColor='ffffff' fontSize='16' />\n\t\t\t\n\t\t\t</categories>";
         $string .= "<categories  bgColor='4567aa' fontColor='ff0000'><category start='{$start1}' end='{$start2}' label='Months'  alpha='' font='Verdana' fontColor='ffffff' fontSize='16' /></categories>";
     }
     $string .= "<categories  bgColor='ffffff' fontColor='1288dd' fontSize='10' isBold='1' align='center'>";
     //gets the first and last year and month in the shipments table
     //stores them in the start var.
     $start = Vaccine_Shipments::get_min_month_year($gantt_data);
     foreach ($start as $starts) {
         $minmonth = $starts['date1'];
         $minyear = $starts['date2'];
         $maxmonth = $starts['date3'];
         $maxyear = $starts['date4'];
     }
     for ($i = $minyear; $i <= $maxyear; $i++) {
         for ($j = $minmonth; $j <= $maxmonth; $j++) {
             //forming the date
             $start = $i . '/' . '0' . $j . '/' . '1';
             $startz = $start;
             //getting last day of the month
             $today = date("Y-m-d", strtotime("+1month -1 second", strtotime(date("Y-m-1", strtotime($start)))));
             $end = date('d/m/Y', strtotime($today));
             //populating names of the month;
             $monthname = date("F", mktime(0, 0, 0, $j, 1, 2000));
             $start2 = date('d/m/Y', strtotime($startz));
             $string .= "<category start='{$start2}' end='{$end}' label='{$monthname}'/>";
         }
     }
     $string .= "</categories>";
     $string .= "<processes headerText='Task' fontColor='000000' fontSize='11' isAnimated='1' bgColor='4567aa'  headerVAlign='bottom' headerAlign='left' headerbgColor='4567aa' headerFontColor='ffffff' headerFontSize='12'  align='left' isBold='1' bgAlpha='25'>";
     $task_id = Vaccine_Shipments::get_task_name($gantt_data);
     foreach ($task_id as $task_ids) {
         $id = $task_ids['task_id'];
         $id2 = $task_ids['id'];
         $task = tasks::get_task_name($id);
         foreach ($task as $tasks) {
             $name = $tasks['name'];
             $name_vaccine = $name . " for " . $vacc;
             $string .= "<process label='{$name}' id='{$id2}'/>";
         }
     }
     $string .= "</process>";
     $string .= "<dataTable showProcessName='1' nameAlign='left' fontColor='000000' fontSize='10' vAlign='right' align='center' headerVAlign='bottom' headerAlign='left' headerbgColor='4567aa' headerFontColor='ffffff' headerFontSize='12' >";
     $all_dates = Vaccine_Shipments::get_them_dates($gantt_data);
     $string .= "<dataColumn bgColor='eeeeee' headerText='Start'>";
     $all_dates = Vaccine_Shipments::get_them_dates($gantt_data);
     foreach ($all_dates as $dates) {
         $initialx = $dates['expected_end_date'];
         $initial = date('d/m/Y', strtotime($initialx));
         $string .= "<text label='{$initial}'/>";
     }
     $string .= "</dataColumn>";
     $string .= "<dataColumn bgColor='eeeeee' headerText='Finish'>";
     $all_dates = Vaccine_Shipments::get_them_dates($gantt_data);
     foreach ($all_dates as $dates) {
         $initialx = $dates['end_date'];
         $initial = date('d/m/Y', strtotime($initialx));
         $string .= "<text label='{$initial}'/>";
     }
     $string .= "</dataColumn>";
     $string .= "</dataTable>";
     $range = Vaccine_Shipments::get_range($gantt_data);
     foreach ($range as $ranges) {
         $minmonth = $ranges['date1'];
         $max = $ranges['date3'];
     }
     $task_id = Vaccine_Shipments::get_them_dates($gantt_data);
     $string .= "<tasks>";
     foreach ($task_id as $task_id) {
         //stores the id of the task
         @($id = $task_id['id']);
         //stores the date the task was initiated by a user
         @($initialx = $task_id['Initiate_date']);
         @($initial2 = date('d/m/Y', strtotime($initialx)));
         //stores the expected end date for a particular task
         //default duration is currently 7 days
         @($endx = $task_id['expected_end_date']);
         @($end = date('d/m/Y', strtotime($endx)));
         //stores the actual end date of a task
         @($actual = $task_id['end_date']);
         @($actual_end = date('d/m/y', strtotime($actual)));
         //if function to change the color of the bar
         if ($actual_end <= $end) {
             $color_bar = 'EEEEEE';
             $text_bar = 'Actual: On Schedule';
         } else {
             $color_bar = 'ED0909';
             $text_bar = 'Actual: Overdue';
         }
         $string .= "<task label='Planned' processId='{$id}' start='{$initial2}' end='{$end}' id='{$id}-1' color='4567aa' height='22%' topPadding='12%'/>";
         $string .= "<task label='" . $text_bar . "' processId='{$id}' start='{$initial2}' end='{$actual_end}' id='{$id}' color='" . $color_bar . "' alpha='100'  topPadding='40%' height='22%' />";
     }
     $string .= "</tasks>";
     $string .= "\t\n\t\t\t<legend>\n\t\t\t        <item label='Planned' color='4567aa' />\n\t\t\t        <item label='Actual' color='999999' />\n\t\t\t        \n\t\t\t</legend>\n\t\t\t";
     $string .= "\t\n\t\t\t\t<styles>\n\t\t\t\t        <definition>\n\t\t\t\t                <style type='Font' name='legendFont' size='12' />\n\t\t\t\t        </definition>\n\t\t\t\t        <application>\n\t\t\t\t                <apply toObject='LEGEND' styles='legendFont' />\n\t\t\t\t        </application>\n\t\t\t\t</styles>";
     $string .= "</chart>";
     echo $string;
 }
Ejemplo n.º 6
0
        // opprette svar?
        $preview = false;
        if (isset($_POST['reply']) && (isset($_POST['add']) || isset($_POST['preview']))) {
            $content = trim(postval("content"));
            if (mb_strlen($content) == 0) {
                $_base->page->add_message("Mangler innhold.", "error");
            } elseif (isset($_POST['preview'])) {
                $preview = true;
                $_base->page->add_message("Viser forhåndsvisning");
            } else {
                \Kofradia\DB::get()->exec("INSERT INTO henvendelser_messages SET hm_h_id = {$h_id}, hm_time = " . time() . ", hm_ip = " . \Kofradia\DB::quote($_SERVER['REMOTE_ADDR']) . ", hm_up_id = " . (login::$logged_in ? login::$user->player->id : "NULL") . ", hm_browser = " . \Kofradia\DB::quote($_SERVER['HTTP_USER_AGENT']) . ", hm_content = " . \Kofradia\DB::quote($content));
                $_base->page->add_message("Meldingen ble lagt til.");
                // oppdatere henvendelsen
                \Kofradia\DB::get()->exec("UPDATE henvendelser SET h_status = 0, h_hm_time = " . time() . " WHERE h_id = {$h_id}");
                // oppdater cache
                tasks::set("henvendelser", \Kofradia\DB::get()->query("SELECT COUNT(h_id) FROM henvendelser WHERE h_status = 0")->fetchColumn(0));
                // send e-post til henrik
                $mail = new email();
                $mail->text = "Ny melding i henvendelse:\n\nNavn: {$h['h_name']}\nE-post: {$h['h_email']}\nTidspunkt: " . $_base->date->get()->format(date::FORMAT_SEC) . "\n\nIP-adresse: {$_SERVER['REMOTE_ADDR']}\nNettleser: {$_SERVER['HTTP_USER_AGENT']}\n\nDirektelink: {$__server['path']}/henvendelser?a&h_id={$h_id}\n\nKategori: {$h['h_category']}\nEmne: {$h['h_subject']}\n\n------\n{$content}\n------";
                $mail->send("*****@*****.**", "Ny melding i henvendelse mottatt - {$h['h_category']}: {$h['h_subject']}");
                redirect::handle("henvendelser?h_id={$h_id}");
            }
        }
        // hent alle meldingene
        $result = \Kofradia\DB::get()->query("SELECT hm_time, hm_ip, hm_browser, hm_content, hm_crew FROM henvendelser_messages WHERE hm_h_id = {$h_id} AND hm_type = 0 ORDER BY hm_time");
        echo '
<p class="h_info"><span class="h_title">' . htmlspecialchars($h['h_category']) . ': ' . htmlspecialchars($h['h_subject']) . '</span> ' . $status['other'][$h['h_status']] . '</p>
<div class="henvendelser_meldinger">';
        // forhåndsvisning?
        $preview_row = false;
        if ($preview) {
Ejemplo n.º 7
0
				
				$string.= "<category start='$start2' end='$end' label='$monthname'/>

";

			}
		}

		$string.= "</categories>";

		$string.= "<processes headerText='Task' fontColor='000000' fontSize='11' isAnimated='1' bgColor='4567aa'  headerVAlign='bottom' headerAlign='left' headerbgColor='4567aa' headerFontColor='ffffff' headerFontSize='12'  align='left' isBold='1' bgAlpha='25'>";
		$task_id = Shipments::get_task_name();
		foreach ($task_id as $task_ids) {
			$id = $task_ids['task_id'];
			$id2 = $task_ids['id'];
			$task = tasks::get_task_name($id);
			foreach ($task as $tasks) {
				$name = $tasks['name'];

				$string.= "<process label='$name' id='$id2'/>";

			}

		}
		$string.= "</process>";

		$string.= "<dataTable showProcessName='1' nameAlign='left' fontColor='000000' fontSize='10' vAlign='right' align='center' headerVAlign='bottom' headerAlign='left' headerbgColor='4567aa' headerFontColor='ffffff' headerFontSize='12' > <dataColumn bgColor='eeeeee' headerText='Expected' >";
		$all_dates = Shipments::get_them_dates();

		foreach ($all_dates as $dates) {
			$initialx = $dates['Initiate_date'];
Ejemplo n.º 8
0
 /**
  * Slett søknad
  * @param integer $ds_id
  * @param boolean $force slette selv om den er behandlet
  */
 public static function delete($ds_id, $force = false)
 {
     global $_base;
     $ds_id = (int) $ds_id;
     $where = $force ? '' : ' AND ds_reply_decision = 0';
     // slett søknaden
     $a = \Kofradia\DB::get()->exec("DELETE FROM div_soknader WHERE ds_id = {$ds_id}{$where}");
     if ($a == 0) {
         return false;
     }
     // oppdater cache
     tasks::set("soknader", \Kofradia\DB::get()->query("SELECT COUNT(ds_id) FROM div_soknader WHERE ds_reply_decision = 0")->fetchColumn(0));
     return true;
 }
Ejemplo n.º 9
0
 /**
  * Hent diverse infobokser for crew
  */
 public static function getExtendedAccessBoxes()
 {
     if (!isset(\login::$extended_access)) {
         return;
     }
     if (!\login::extended_access_is_authed()) {
         return;
     }
     $boxes = array();
     // support meldinger
     if (\access::has("crewet")) {
         $row = \tasks::get("support");
         if ($row['t_ant'] > 0) {
             $boxes[] = array(\ess::$s['relative_path'] . '/support/?a=panel&amp;kategori=oppsummering', 'Det er <b>' . $row['t_ant'] . '</b> ' . fword("ubesvart supportmelding", "ubesvarte supportmeldinger", $row['t_ant']) . '!');
         }
     }
     // hent antall nye rapporteringer fra cache
     $row = \tasks::get("rapporteringer");
     if ($row['t_ant'] > 0) {
         $boxes[] = array(\ess::$s['relative_path'] . '/crew/rapportering', 'Det er <b>' . $row['t_ant'] . '</b> ' . fword("ubehandlet rapportering", "ubehandlede rapporteringer", $row['t_ant']) . '.');
     }
     // hent antall nye søknader fra cache
     $row = \tasks::get("soknader");
     if ($row['t_ant'] > 0) {
         $boxes[] = array(\ess::$s['relative_path'] . '/crew/soknader', 'Det er <b>' . $row['t_ant'] . '</b> ' . fword("ubehandlet søknad", "ubehandlede søknader", $row['t_ant']) . '.');
     }
     // antall ubesvarte henvendelser
     if (\access::has("mod")) {
         // hent antall nye henvendelser fra cache
         $row = \tasks::get("henvendelser");
         if ($row['t_ant'] > 0) {
             $boxes[] = array(\ess::$s['relative_path'] . '/henvendelser?a', 'Det er <b>' . $row['t_ant'] . '</b> ' . fword("ny henvendelse", "nye henvendelser", $row['t_ant']) . ' som er ubesvart.');
         }
     }
     // hendelser fra GitHub
     $github = \Kofradia\Users\GitHub::get(\login::$user);
     if (!$github->hasActivated()) {
         $boxes[] = array(\ess::$s['relative_path'] . '/github', 'Du vil nå motta nye hendelser fra GitHub her. Trykk her for å se de siste hendelsene.');
     } else {
         $num_changes = $github->getCodeBehindCount() + $github->getOtherBehindCount();
         if ($num_changes > 0) {
             $boxes[] = array(\ess::$s['relative_path'] . '/github', 'Det er <b>' . $num_changes . '</b> ny' . ($num_changes == 1 ? '' : 'e') . ' hendelse' . ($num_changes == 1 ? '' : 'r') . ' i GitHub.');
         }
     }
     return $boxes;
 }
Ejemplo n.º 10
0
 /** Oppdater cache */
 public static function update_tasks()
 {
     tasks::set("support", \Kofradia\DB::get()->query("SELECT COUNT(su_id) FROM support WHERE su_solved = 0")->fetchColumn(0));
 }
Ejemplo n.º 11
0
<?php

echo $_SERVER['DOCUMENT_ROOT'];
include_once '../model/tasks.php';
$tasks = new tasks();
$user_id = $_SESSION['userid'];
if (isset($_POST['add_task'])) {
    if (!empty($_POST['task_name']) && !empty($_POST['task_body'])) {
        $addtask['user_id'] = $user_id;
        $addtask['name'] = $_POST['task_name'];
        $addtask['body'] = $_POST['task_body'];
        //            $addtask['to']=$_POST['task_to_date'];
        //            $addtask['to_time']=$_POST['task_to_time'];
        //            $addtask['from']=$_POST['task_from_date'];
        //            $addtask['from_time']=$_POST['task_from_time'];
        //            $addtask['category']=$_POST['task_category'];
        $addtask['created'] = date("Y-m-d,H-m-s");
        $task_new_id = $tasks->add_task($addtask);
    }
}
?>
<div class="sub">
    <h2>Task </h2>
    <div class="tasks_form">
        <ul class="tasks_ul">
            <?php 
$sql = $tasks->view_tasks($user_id);
while ($rows_tasks = mysqli_fetch_array($sql)) {
    echo "<li style='background:red;'>" . $rows_tasks['name'] . "</li>";
}
?>