Ejemplo n.º 1
0
/**
* Sub-function to collect events within a period
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen)
{
    global $AppUI, $event_filter;
    $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter);
    // assemble the links for the events
    foreach ($events as $row) {
        $start = new CDate($row['event_start_date']);
        $end = new CDate($row['event_end_date']);
        $date = $start;
        $date->setTime(0, 0, 0);
        $cwd = explode(',', $GLOBALS['dPconfig']['cal_working_days']);
        for ($i = 0, $x = $end->dateDiff($start); $i <= $x; $i++) {
            // the link
            // optionally do not show events on non-working days
            if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) {
                $link['href'] = '?m=calendar&a=view&event_id=' . $row['event_id'];
                $link['alt'] = $row['event_description'];
                $link['text'] = dPshowImage(dPfindImage('event' . $row['event_type'] . '.png', 'calendar'), 16, 16) . htmlspecialchars($row['event_title']);
                if ($i == 0) {
                    $link['alt'] .= ' [' . $AppUI->_('START') . ']';
                }
                if ($i == $x) {
                    $link['alt'] .= ' [' . $AppUI->_('END') . ']';
                }
                $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link;
            }
            $date = $date->getNextDay();
        }
    }
}
Ejemplo n.º 2
0
/**
 * Sub-function to collect events within a period
 * @param Date the starting date of the period
 * @param Date the ending date of the period
 * @param array by-ref an array of links to append new items to
 * @param int the length to truncate entries by
 * @author Andrew Eddie <eddieajau@users.sourceforge.net>
 */
function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $minical = false)
{
    global $event_filter;
    $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter);
    $cwd = explode(',', w2PgetConfig('cal_working_days'));
    // assemble the links for the events
    foreach ($events as $row) {
        $start = new CDate($row['event_start_date']);
        $end = new CDate($row['event_end_date']);
        $date = $start;
        for ($i = 0, $i_cmp = $start->dateDiff($end); $i <= $i_cmp; $i++) {
            // the link
            // optionally do not show events on non-working days
            if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) {
                if ($minical) {
                    $link = array();
                } else {
                    $url = '?m=calendar&a=view&event_id=' . $row['event_id'];
                    $link['href'] = '';
                    $link['alt'] = '';
                    $link['text'] = w2PtoolTip($row['event_title'], getEventTooltip($row['event_id']), true) . w2PshowImage('event' . $row['event_type'] . '.png', 16, 16, '', '', 'calendar') . '</a>&nbsp;' . '<a href="' . $url . '"><span class="event">' . $row['event_title'] . '</span></a>' . w2PendTip();
                }
                $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link;
            }
            $date = $date->getNextDay();
        }
    }
}
Ejemplo n.º 3
0
 public function testConvertTZ()
 {
     $myDate1 = new CDate('', 'US/Eastern');
     $this->assertEquals($myDate1, new CDate('', 'US/Eastern'));
     $myDate2 = new CDate('', 'CST');
     $myDate2->convertTZ('EST');
     //This tweaks the test data in case the +1 is across the day change.
     $tmpHour = $myDate1->hour + 1 >= 24 ? $myDate1->hour + 1 - 24 : $myDate1->hour + 1;
     $this->assertEquals($tmpHour, $myDate2->hour);
     $this->assertEquals($myDate1->minute, $myDate2->minute);
     $myDate2->convertTZ('PST');
     $tmpHour = $myDate1->hour - 2 < 0 ? $myDate1->hour - 2 + 24 : $myDate1->hour - 2;
     $this->assertEquals($tmpHour, $myDate2->hour);
 }
Ejemplo n.º 4
0
	function create($sitemap_name = '') {
		
		if(!$sitemap_name) $sitemap_name = SS_ADMIN_TO_USERFILE . "/sitemap.xml";
		
		if(empty($sitemap_name)) $sitemap_name = "sitemap_" . $rep_name . ".xml";
		$changefreq 	= array('daily', 'weekly', 'monthly');
		$priority		= array('0.1', '0.5', '1.0');
		$tab_archive	= array();

		rsort($tab_archive);
		$xml = simplexml_load_file(SS_ADMIN_TO_USERFILE . '/google/sitemap_base.xml');
		
		//scan bdd
		$sql = "SELECT * FROM page WHERE etat = 1";
		$res = CBdd::select($sql);
		while($page = mysql_fetch_array($res)) {
			$url = $xml->addChild('url');
			$url->addChild('loc', CUrl::get_urlsite() . "/" . CFunction::formate_chaine(utf8_decode($page['nom']), '-') . "_p" . $page['id']. ".html");
			$url->addChild('lastmod', CDate::formate_date($page['date']));
			$url->addChild('changefreq', $changefreq[rand(0, 2)]);
			$url->addChild('priority', $priority[rand(0, 2)]);
		}

		$html = $xml->asXML();
		file_put_contents($sitemap_name, $html);
	}
function showchilddept_maintenance(&$a, $level = 0)
{
    global $AppUI, $df, $rownum;
    if (strlen($a["dept_batching_maintenance"]) == 0) {
        $batching_expire_date = null;
    } else {
        $batching_expire_date = new CDate($a["dept_batching_maintenance"]);
    }
    $s .= '<td><a href="?m=departments&amp;a=view&amp;dept_id=' . $a['dept_id'] . '">' . $a['dept_name'] . '</a>';
    $s .= '<input type="hidden" name="dept_id[]" id="dept_id' . $rownum . '" value="' . $a['dept_id'] . '" />';
    $s .= '</td>';
    $s .= '<td> <input type="text" class="text" name="batching_maintenance[]" id="batching_maintenance' . $rownum . '" disabled="disabled" value="' . ($batching_expire_date ? $batching_expire_date->format($df) : '') . '"/>';
    $s .= '<input type="hidden" name="dept_batching_maintenance[]" id="dept_batching_maintenance' . $rownum . '" value="' . ($batching_expire_date ? $batching_expire_date->format(FMT_TIMESTAMP_DATE) : '') . '" />';
    $s .= '<a href="#" onclick="javascript:popCalendar(getRow(event))"> <img src="./images/calendar.gif" name="img_expiredate" width="24" height="12" alt="' . $AppUI->_('Calendar') . '" border="0" /></a>';
    $s .= '</td>';
    $dept_checked = time() > strtotime($a['dept_batching_maintenance']) ? "checked='checked'" : "";
    //checked for expired dept.
    $s .= "<td align='center'><input type='checkbox' value='{$a['dept_id']}' {$dept_checked} name='select_dept[]'></td>";
    echo '<tr>' . $s . '</tr>';
    $rownum = $rownum + 1;
}
Ejemplo n.º 6
0
 function addHelpDeskTaskLog()
 {
     global $AppUI, $helpdesk_available;
     if ($helpdesk_available && $this->file_helpdesk_item != 0) {
         // create task log with information about the file that was uploaded
         $task_log = new CHDTaskLog();
         $task_log->task_log_help_desk_id = $this->_hditem->item_id;
         if ($this->_message != 'deleted') {
             $task_log->task_log_name = 'File ' . $this->file_name . ' uploaded';
         } else {
             $task_log->task_log_name = 'File ' . $this->file_name . ' deleted';
         }
         $task_log->task_log_description = $this->file_description;
         $task_log->task_log_creator = $AppUI->user_id;
         $date = new CDate();
         $task_log->task_log_date = $date->format(FMT_DATETIME_MYSQL);
         if ($msg = $task_log->store()) {
             $AppUI->setMsg($msg, UI_MSG_ERROR);
         }
     }
     return NULL;
 }
function showchilddept_maintenance(&$a, $level = 0)
{
    global $AppUI, $df, $rownum;
    if (strlen($a["dept_batching_maintenance"]) == 0) {
        $batching_expire_date = null;
    } else {
        $batching_expire_date = new CDate($a["dept_batching_maintenance"]);
    }
    $s .= '<td align="center"><a href="?m=departments&amp;a=view&amp;dept_id=' . $a['dept_id'] . '">' . $a['dept_name'] . '</a>';
    $s .= '<input type="hidden" name="dept_id[]" id="dept_id' . $rownum . '" value="' . $a['dept_id'] . '" />';
    $s .= '</td>';
    $s .= '<td align="center"> <input type="text" class="text" name="batching_maintenance[]" id="batching_maintenance' . $rownum . '" disabled="disabled" value="' . ($batching_expire_date ? $batching_expire_date->format($df) : '') . '"/>';
    $s .= '<input type="hidden" name="dept_batching_maintenance[]" id="dept_batching_maintenance' . $rownum . '" value="' . ($batching_expire_date ? $batching_expire_date->format(FMT_TIMESTAMP_DATE) : '') . '" />';
    $s .= '<a href="#" onclick="javascript:popCalendar(getRow(event))"> <img src="./images/calendar.gif" name="img_expiredate" width="24" height="12" alt="' . $AppUI->_('Calendar') . '" border="0" /></a>';
    $s .= '</td>';
    $calAdder = '<a href="javascript:void(0)" onclick="javascript:popCalendarAccept(getRow(event))"> <img src="./images/calendar.gif" name="img_expiredate2" width="24" height="12" alt="' . $AppUI->_('Calendar') . '" border="0" /></a>';
    $last_report_generation_date = $a['last_report_generation_date'] == "0000-00-00 00:00:00" ? "Not Generated Yet" : date("d/M/Y", strtotime($a['last_report_generation_date']));
    $last_report_accept_date = date("d/M/Y", strtotime($a['last_report_accept_date']));
    $last_report_accept_date_hidden = date("Ymd", strtotime($a['last_report_accept_date']));
    $s .= "<td align='center'>{$last_report_generation_date}</td><td align='center'><input class='text' id='last_report_accept_date_hidden{$rownum}' name='last_report_accept_date_hidden[]' value='{$last_report_accept_date_hidden}' type='hidden'><input type='text' name='last_report_accept_date[]' id='last_report_accept_date{$rownum}' class='text' value='{$last_report_accept_date}' disabled>{$calAdder}</td>";
    echo '<tr>' . $s . '</tr>';
    $rownum = $rownum + 1;
}
Ejemplo n.º 8
0
/**
* Sub-function to collect events within a period
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getEventLinks($startPeriod, $endPeriod, &$links, $strMaxLen)
{
    global $event_filter;
    $events = CEvent::getEventsForPeriod($startPeriod, $endPeriod, $event_filter);
    // assemble the links for the events
    foreach ($events as $row) {
        $start = new CDate($row['event_start_date']);
        $end = new CDate($row['event_end_date']);
        $date = $start;
        $cwd = explode(",", $GLOBALS["dPconfig"]['cal_working_days']);
        for ($i = 0; $i <= $start->dateDiff($end); $i++) {
            // the link
            // optionally do not show events on non-working days
            if ($row['event_cwd'] && in_array($date->getDayOfWeek(), $cwd) || !$row['event_cwd']) {
                $url = '?m=calendar&a=view&event_id=' . $row['event_id'];
                $link['href'] = '';
                $link['alt'] = $row['event_description'];
                $link['text'] = '<table cellspacing="0" cellpadding="0" border="0"><tr>' . '<td><a href=' . $url . '>' . dPshowImage(dPfindImage('event' . $row['event_type'] . '.png', 'calendar'), 16, 16, '') . '</a></td>' . '<td><a href="' . $url . '" title="' . $row['event_description'] . '"><span class="event">' . $row['event_title'] . '</span></a>' . '</td></tr></table>';
                $links[$date->format(FMT_TIMESTAMP_DATE)][] = $link;
            }
            $date = $date->getNextDay();
        }
    }
}
Ejemplo n.º 9
0
    $AppUI->redirect();
}
require_once $AppUI->getSystemClass('CustomFields');
//一些转化
// convert dates to SQL format first
if ($obj->project_start_date) {
    $date = new CDate($obj->project_start_date);
    $obj->project_start_date = $date->format(FMT_DATETIME_MYSQL);
}
if ($obj->project_end_date) {
    $date = new CDate($obj->project_end_date);
    $date->setTime(23, 59, 59);
    $obj->project_end_date = $date->format(FMT_DATETIME_MYSQL);
}
if ($obj->project_actual_end_date) {
    $date = new CDate($obj->project_actual_end_date);
    $obj->project_actual_end_date = $date->format(FMT_DATETIME_MYSQL);
}
// let's check if there are some assigned departments to project
//部门分配
if (!dPgetParam($_POST, "project_departments", 0)) {
    //返回一个部门的id
    $obj->project_departments = implode(",", dPgetParam($_POST, "dept_ids", array()));
}
$del = dPgetParam($_POST, 'del', 0);
// prepare (and translate) the module name ready for the suffix
if ($del) {
    $project_id = dPgetParam($_POST, 'project_id', 0);
    $canDelete = $obj->canDelete($msg, $project_id);
    if (!$canDelete) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
Ejemplo n.º 10
0
        $bar->setColor('darkgray');
        $bar->SetFillColor('darkgray');
        $bar->SetPattern(BAND_SOLID, 'gray');
        $bar->progress->SetFillColor('darkgray');
        $bar->progress->SetPattern(BAND_SOLID, 'gray', 98);
    }
    $q = new DBQuery();
    $q->addTable('task_dependencies');
    $q->addQuery('dependencies_task_id');
    $q->addWhere('dependencies_req_task_id=' . (int) $a['task_id']);
    $query = $q->loadList();
    foreach ($query as $dep) {
        // find row num of dependencies
        for ($d = 0, $d_cmp = count($gantt_arr); $d < $d_cmp; $d++) {
            if ($gantt_arr[$d][0]['task_id'] == $dep['dependencies_task_id']) {
                $bar->SetConstrain($d, CONSTRAIN_ENDSTART);
            }
        }
    }
    unset($query);
    $q->clear();
    $graph->Add($bar);
}
unset($gantt_arr);
$today = new CDate();
$vline = new GanttVLine($today->format(FMT_TIMESTAMP_DATE), $AppUI->_('Today', UI_OUTPUT_RAW));
if (is_file(TTF_DIR . 'FreeSans.ttf')) {
    $vline->title->SetFont(FF_CUSTOM, FS_BOLD, 10);
}
$graph->Add($vline);
$graph->Stroke();
Ejemplo n.º 11
0
    $s .= $CR . "</td>";
    $s .= $CR . '<td width="99%"><a href="?m=helpdesk&a=view&item_id=' . $row["item_id"] . '">' . $row["item_title"] . '</a></td>';
    $s .= $CR . "<td nowrap align=\"center\">";
    if ($row["assigned_email"]) {
        $s .= $CR . "<a href=\"mailto:" . $row["assigned_email"] . "\">" . $row['assigned_fullname'] . "</a>";
    } else {
        $s .= $CR . $row['assigned_fullname'];
    }
    $s .= $CR . "</td>";
    $s .= $CR . '<td align="center" nowrap>' . $AppUI->_($ist[@$row["item_status"]]) . '</td>';
    $s .= $CR . '<td align="center" nowrap>' . $AppUI->_($ipr[@$row["item_priority"]]) . '</td>';
    //Lets retrieve the updated date
    //	$sql = "SELECT MAX(status_date) status_date FROM helpdesk_item_status WHERE status_item_id =".$row['item_id'];
    //	$sdrow = db_loadList( $sql );
    //	$dateu = new CDate( $sdrow[0]['status_date'] );
    $dateu = new CDate($row['item_updated']);
    $s .= $CR . '<td align="center" nowrap>' . @$dateu->format($format) . '</td>';
    if ($row['project_id']) {
        $s .= $CR . '<td align="center" style="background-color: #' . $row['project_color_identifier'] . ';" nowrap><a href="./index.php?m=projects&a=view&project_id=' . $row['project_id'] . '" style="color: ' . bestColor(@$row["project_color_identifier"]) . ';">' . $row['project_name'] . '</a></td>';
    } else {
        $s .= $CR . '<td align="center">-</td>';
    }
    $s .= $CR . '</tr></form>';
}
print "{$s}\n";
// Pagination
$pages = 0;
if ($total_results > $items_per_page) {
    $pages_per_side = $HELPDESK_CONFIG['pages_per_side'];
    $pages = ceil($total_results / $items_per_page) - 1;
    if ($page < $pages_per_side) {
Ejemplo n.º 12
0
/**
* Sub-function to collect tasks within a period
*
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @param int the company id to filter by
* @author Andrew Eddie <eddieajau@users.sourceforge.net>
*/
function getTaskLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $company_id = 0)
{
    global $a, $AppUI, $dPconfig;
    $tasks = CTask::getTasksForPeriod($startPeriod, $endPeriod, $company_id, $AppUI->user_id, true);
    $durnTypes = dPgetSysVal('TaskDurationType');
    $link = array();
    $sid = 3600 * 24;
    // assemble the links for the tasks
    foreach ($tasks as $row) {
        // the link
        $link['href'] = "?m=tasks&a=view&task_id=" . $row['task_id'];
        $link['alt'] = $row['project_name'] . ":\n" . $row['task_name'];
        // the link text
        if (strlen($row['task_name']) > $strMaxLen) {
            $row['task_name'] = substr($row['task_name'], 0, $strMaxLen) . '...';
        }
        $link['text'] = '<span style="color:' . bestColor($row['color']) . ';background-color:#' . $row['color'] . '">' . $row['task_name'] . '</span>';
        // determine which day(s) to display the task
        $start = new CDate($row['task_start_date']);
        $end = $row['task_end_date'] ? new CDate($row['task_end_date']) : null;
        $durn = $row['task_duration'];
        $durnType = $row['task_duration_type'];
        if (($start->after($startPeriod) || $start->equals($startPeriod)) && ($start->before($endPeriod) || $start->equals($endPeriod))) {
            $temp = $link;
            $temp['alt'] = "START [" . $row['task_duration'] . ' ' . $AppUI->_($durnTypes[$row['task_duration_type']]) . "]\n" . $link['alt'];
            if ($a != 'day_view') {
                $temp['text'] = dPshowImage(dPfindImage('block-start-16.png')) . $temp['text'];
            }
            $links[$start->format(FMT_TIMESTAMP_DATE)][] = $temp;
        }
        if ($end && $end->after($startPeriod) && $end->before($endPeriod) && $start->before($end)) {
            $temp = $link;
            $temp['alt'] = "FINISH\n" . $link['alt'];
            if ($a != 'day_view') {
                $temp['text'] .= dPshowImage(dPfindImage('block-end-16.png'));
            }
            $links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
        }
        // convert duration to days
        if ($durnType < 24.0) {
            if ($durn > $dPconfig['daily_working_hours']) {
                $durn /= $dPconfig['daily_working_hours'];
            } else {
                $durn = 0.0;
            }
        } else {
            $durn *= $durnType / 24.0;
        }
        // fill in between start and finish based on duration
        // notes:
        // start date is not in a future month, must be this or past month
        // start date is counted as one days work
        // business days are not taken into account
        $target = $start;
        $target->addSeconds($durn * $sid);
        if (Date::compare($target, $startPeriod) < 0) {
            continue;
        }
        if (Date::compare($start, $startPeriod) > 0) {
            $temp = $start;
            $temp->addSeconds($sid);
        } else {
            $temp = $startPeriod;
        }
        // Optimised for speed, AJD.
        while (Date::compare($endPeriod, $temp) > 0 && Date::compare($target, $temp) > 0 && ($end == null || $temp->before($end))) {
            $links[$temp->format(FMT_TIMESTAMP_DATE)][] = $link;
            $temp->addSeconds($sid);
        }
    }
}
/**
* Document::db_dateTime2locale()
*
* { Description }
*
*/
function db_dateTime2locale($dateTime, $format)
{
    if (intval($dateTime)) {
        $date = new CDate($dateTime);
        return $date->format($format);
    } else {
        return null;
    }
}
Ejemplo n.º 14
0
function showWeeks()
{
    global $allocated_hours_sum, $end_date, $start_date, $AppUI, $user_list, $user_names, $user_usage, $hideNonWd, $table_header, $table_rows, $df, $working_days_count, $total_hours_capacity, $total_hours_capacity_all;
    $working_days_count = 0;
    $allocated_hours_sum = 0;
    $ed = new CDate(Date_Calc::endOfWeek($end_date->day, $end_date->month, $end_date->year));
    $sd = new CDate(Date_Calc::beginOfWeek($start_date->day, $start_date->month, $start_date->year));
    $week_difference = ceil($ed->workingDaysInSpan($sd) / count(explode(",", dPgetConfig("cal_working_days"))));
    $actual_date = $sd;
    $table_header = "<tr><th>" . $AppUI->_("User") . "</th>";
    for ($i = 0; $i < $week_difference; $i++) {
        $table_header .= "<th>" . Date_Calc::weekOfYear($actual_date->day, $actual_date->month, $actual_date->year) . "<br><table><td style='font-weight:normal; font-size:70%'>" . $actual_date->format($df) . "</td></table></th>";
        $actual_date->addSeconds(168 * 3600);
        // + one week
    }
    $table_header .= "<th nowrap='nowrap' colspan='2'>" . $AppUI->_("Allocated") . "</th></tr>";
    $table_rows = "";
    foreach ($user_list as $user_id => $user_data) {
        @($user_names[$user_id] = $user_data["user_username"]);
        if (isset($user_usage[$user_id])) {
            $table_rows .= "<tr><td nowrap='nowrap'>(" . $user_data["user_username"] . ") " . $user_data["contact_first_name"] . " " . $user_data["contact_last_name"] . "</td>";
            $actual_date = $sd;
            for ($i = 0; $i < $week_difference; $i++) {
                $awoy = $actual_date->year . Date_Calc::weekOfYear($actual_date->day, $actual_date->month, $actual_date->year);
                $table_rows .= "<td align='right'>";
                if (isset($user_usage[$user_id][$awoy])) {
                    $hours = number_format($user_usage[$user_id][$awoy], 2);
                    $table_rows .= $hours;
                    $percentage_used = round($hours / (dPgetConfig("daily_working_hours") * count(explode(",", dPgetConfig("cal_working_days")))) * 100);
                    $bar_color = "blue";
                    if ($percentage_used > 100) {
                        $bar_color = "red";
                        $percentage_used = 100;
                    }
                    $table_rows .= "<div style='height:2px;width:{$percentage_used}%; background-color:{$bar_color}'>&nbsp;</div>";
                } else {
                    $table_rows .= "&nbsp;";
                }
                $table_rows .= "</td>";
                $actual_date->addSeconds(168 * 3600);
                // + one week
            }
            $array_sum = array_sum($user_usage[$user_id]);
            $average_user_usage = number_format($array_sum / ($week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours")) * 100, 2);
            $allocated_hours_sum += $array_sum;
            $bar_color = "blue";
            if ($average_user_usage > 100) {
                $bar_color = "red";
                $average_user_usage = 100;
            }
            $table_rows .= "<td ><div align='left'>" . round($array_sum, 2) . " " . $AppUI->_("hours") . "</td> <td align='right'> " . $average_user_usage;
            $table_rows .= "%</div>";
            $table_rows .= "<div align='left' style='height:2px;width:{$average_user_usage}%; background-color:{$bar_color}'>&nbsp;</div></td>";
            $table_rows .= "</tr>";
        }
    }
    $total_hours_capacity = $week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours") * count($user_usage);
    $total_hours_capacity_all = $week_difference * count(explode(",", dPgetConfig("cal_working_days"))) * dPgetConfig("daily_working_hours") * count($user_list);
}
Ejemplo n.º 15
0
function formatTime($uts)
{
    global $AppUI;
    $date = new CDate();
    $date->setDate($uts, DATE_FORMAT_UNIXTIME);
    return $date->format($AppUI->getPref('SHDATEFORMAT'));
}
Ejemplo n.º 16
0
 /**
 * Calculating if an recurrent date is in the given period
 * @param Date Start date of the period
 * @param Date End date of the period
 * @param Date Start date of the Date Object
 * @param Date End date of the Date Object
 * @param integer Type of Recurrence
 * @param integer Times of Recurrence
 * @param integer Time of Recurrence
 * @return array Calculated Start and End Dates for the recurrent Event for the given Period
 */
 function getRecurrentEventforPeriod($start_date, $end_date, $event_start_date, $event_end_date, $event_recurs, $event_times_recuring, $j)
 {
     //this array will be returned
     $transferredEvent = array();
     //create Date Objects for Event Start and Event End
     $eventStart = new CDate($event_start_date);
     $eventEnd = new CDate($event_end_date);
     //Time of Recurence = 0 (first occurence of event) has to be checked, too.
     if ($j > 0) {
         switch ($event_recurs) {
             case 1:
                 $eventStart->addSpan(new Date_Span(3600 * $j));
                 $eventEnd->addSpan(new Date_Span(3600 * $j));
                 break;
             case 2:
                 $eventStart->addDays($j);
                 $eventEnd->addDays($j);
                 break;
             case 3:
                 $eventStart->addDays(7 * $j);
                 $eventEnd->addDays(7 * $j);
                 break;
             case 4:
                 $eventStart->addDays(14 * $j);
                 $eventEnd->addDays(14 * $j);
                 break;
             case 5:
                 $eventStart->addMonths($j);
                 $eventEnd->addMonths($j);
                 break;
             case 6:
                 $eventStart->addMonths(3 * $j);
                 $eventEnd->addMonths(3 * $j);
                 break;
             case 7:
                 $eventStart->addMonths(6 * $j);
                 $eventEnd->addMonths(6 * $j);
                 break;
             case 8:
                 $eventStart->addMonths(12 * $j);
                 $eventEnd->addMonths(12 * $j);
                 break;
             default:
                 break;
         }
     }
     if ($start_date->compare($start_date, $eventStart) <= 0 && $end_date->compare($end_date, $eventEnd) >= 0) {
         // add temporarily moved Event Start and End dates to returnArray
         $transferredEvent = array($eventStart, $eventEnd);
     }
     // return array with event start and end dates for given period (positive case)
     // or an empty array (negative case)
     return $transferredEvent;
 }
Ejemplo n.º 17
0
          <?php
		  $i = 0; 
		  while ($opportunite = mysql_fetch_array($r_opportunite)) {	
				  $xzsql = "SELECT nom from texte where id=".$opportunite['texId'];
				//print_r($xzsql);
				$text = CBdd::select_one($xzsql,'nom');
				$xzsql = "SELECT piece from hbpiecesjointes where id=".$opportunite['pieId'];
				//print_r($xzsql);
				$piece= CBdd::select_one($xzsql,'piece');
				?>
          <tr>
            <td><a href="?a=5&id=<?=$opportunite['id'] ?>"><?=$opportunite['id'] ?></a></td>
            <td><?=utf8_encode ($opportunite['nom']); ?></td>
			<td><?=$text ; ?></td>
  			<td><?=str_replace('../../userfiles/pieces_jointes/', '',$piece); ?></td>
            <td align="center"><?=CDate::date_switch(CDate::formate_date($opportunite['date'])) ?></td>
            <td align="center"><?=CHtml::get_etat($opportunite['id'], $opportunite['etat'], $opportunite['id']); ?></td>
            <td align="center"><?=CHtmlSession::get_editbutton($opportunite['id'], $opportunite['id']) ?></td>
            <td align="center"><?=CHtml::get_delbutton($a, $opportunite['id'], $id,  $opportunite['id']) ?></td>
          </tr>
          <?php } ?>
        </table>
        <?php } ?>

<?php 
//----------------------------------------------------------------------------------------------
// AJOUT
//----------------------------------------------------------------------------------------------
?>
        <?php if($a == 4) { ?>
        <form id="form_ajout" method="post" action="opportunite.php">
Ejemplo n.º 18
0
 $obj->loadFull($AppUI, $project_id);
 if (!$obj) {
     $AppUI->setMsg('Project');
     $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
     $AppUI->redirect();
 } else {
     $AppUI->savePlace();
 }
 $worked_hours = $obj->project_worked_hours;
 $total_hours = $obj->getTotalHours();
 $total_project_hours = $obj->getTotalProjectHours();
 // create Date objects from the datetime fields
 $start_date = intval($obj->project_start_date) ? new CDate($obj->project_start_date) : null;
 $end_date = intval($obj->project_end_date) ? new CDate($obj->project_end_date) : null;
 $actual_end_date = intval($criticalTasks[0]['task_end_date']) ? new CDate($criticalTasks[0]['task_end_date']) : null;
 $today = new CDate();
 $style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
 $style = $obj->project_percent_complete < 99.98999999999999 && $today > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : $style;
 // setup the title block
 $ttl = 'ProjectDesigner';
 $titleBlock = new CTitleBlock($ttl, 'projectdesigner.png', $m, $m . '.' . $a);
 $titleBlock->addCrumb('?m=projects', 'projects list');
 $titleBlock->addCrumb('?m=' . $m, 'select another project');
 $titleBlock->addCrumb('?m=projects&a=view&bypass=1&project_id=' . $project_id, 'normal view project');
 if ($canAddProject) {
     $titleBlock->addCell();
     $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new project') . '">', '', '<form action="?m=projects&a=addedit" method="post" accept-charset="utf-8">', '</form>');
 }
 if ($canAddTask) {
     $titleBlock->addCell();
     $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new task') . '">', '', '<form action="?m=tasks&a=addedit&task_project=' . $project_id . '" method="post" accept-charset="utf-8">', '</form>');
Ejemplo n.º 19
0
echo $AppUI->_('Description');
?>
</th>
    	<th nowrap="nowrap"><?php 
echo $AppUI->_('Progress');
?>
</th>
	<th nowrap="nowrap"><?php 
echo $AppUI->_('Hours Worked');
?>
</th>
	<th nowrap="nowrap">&nbsp;</th>
  </tr>
  <tr valign="top">
	<?php 
$log_date = new CDate($obj->task_log_date);
?>
    <td>      
	<input type="hidden" name="task_log_date" value="<?php 
echo $log_date->format(FMT_DATETIME_MYSQL);
?>
">
      <input type="text" name="log_date" size="10" value="<?php 
echo $log_date->format($df);
?>
" class="text" disabled="disabled">
      <a href="#" onClick="popCalendar('log_date')">
	<img src="./images/calendar.gif" width="24" height="12" alt="<?php 
echo $AppUI->_('Calendar');
?>
" border="0" />
Ejemplo n.º 20
0
function displayFiles($folder)
{
    global $m, $a, $tab, $AppUI, $xpg_min, $xpg_pagesize;
    global $deny1, $deny2, $project_id, $task_id, $showProject, $file_types, $cfObj;
    global $xpg_totalrecs, $xpg_total_pages, $page;
    global $company_id, $allowed_companies, $current_uri, $dPconfig;
    $canEdit = !getDenyEdit($m, $folder);
    $canRead = !getDenyRead($m, $folder);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    // SETUP FOR FILE LIST
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.*,count(file_version) as file_versions,round(max(file_version), 2) as file_lastversion,file_folder_id, file_folder_name,project_name, project_color_identifier,contact_first_name, contact_last_name,task_name,task_id');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if (count($deny1) > 0) {
        $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
    }
    if (count($deny2) > 0) {
        $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
    }
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $q->addGroup('file_folder');
    $q->addGroup('project_name');
    $q->addGroup('file_name');
    $q->addOrder('file_folder');
    $q->addOrder('project_name');
    $q->addOrder('file_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.file_id, file_version, file_project, file_name, file_task, file_description, user_username as file_owner, file_size, file_category, file_type, file_date, file_folder_name');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadList($file_versions_sql);
    }
    if ($files === array()) {
        return 0;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
	    <th><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Type');
    ?>
</a></th>
		<th><?php 
    echo $AppUI->_('Date');
    ?>
</th>
    	<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
    	<th><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        if ($fp != $row["file_project"]) {
            if (!$row["project_name"]) {
                $row["project_name"] = $AppUI->_('All Projects');
                $row["project_color_identifier"] = 'f4efe3';
            }
            if ($showProject) {
                $s = '<tr>';
                $s .= '<td colspan="20" style="background-color:#' . $row["project_color_identifier"] . '">';
                $s .= '<font color="' . bestColor($row["project_color_identifier"]) . '">';
                if ($row['file_project'] > 0) {
                    $href = './index.php?m=projects&a=view&project_id=' . $row['file_project'];
                } else {
                    $href = './index.php?m=projects';
                }
                $s .= '<a href="' . $href . '">' . $row["project_name"] . '</a>';
                $s .= '</font></td></tr>';
                echo $s;
            }
        }
        $fp = $row["file_project"];
        if ($row['file_versions'] > 1) {
            $file = last_file($file_versions, $row['file_name'], $row['file_project']);
        } else {
            $file = $row;
        }
        ?>
	<form name="frm_remove_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
			<?php 
        $file_icon = getIcon($row['file_type']);
        echo "<a href=\"./fileviewer.php?file_id={$file['file_id']}\" title=\"{$file['file_description']}\"><img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;{$row['file_name']}</a>";
        ?>
		</td>
		<td width="20%"><?php 
        echo $file['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
	        <?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            echo ' <a href="#" onClick="expand(\'versions_' . $file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>';
            $hidden_table = '<tr><td colspan="20">
	<table style="display: none" id="versions_' . $file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
	        <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
	        <th>' . $AppUI->_('Description') . '</th>
	        <th>' . $AppUI->_('Versions') . '</th>
	        <th>' . $AppUI->_('Category') . '</th>
	        <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th>
	        <th>' . $AppUI->_('Owner') . '</th>
	        <th>' . $AppUI->_('Size') . '</th>
	        <th>' . $AppUI->_('Type') . '</a></th>
	        <th>' . $AppUI->_('Date') . '</th>
    		<th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th>
    		<th>' . $AppUI->_('co') . '</th>
	        <th nowrap width="1"></th>
	        <th nowrap width="1"></th>
	</tr>
	';
            foreach ($file_versions as $file_row) {
                if ($file_row['file_name'] == $row['file_name'] && $file_row['file_project'] == $row['file_project']) {
                    $file_icon = getIcon($file_row['file_type']);
                    $file_date = new CDate($file_row['file_date']);
                    $hidden_table .= '	
			<form name="frm_delete_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="del" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '	
			<form name="frm_duplicate_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="duplicate" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '
	        <tr>
	                <td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file_row['file_id'] . '" 
	                        title="' . $file_row['file_description'] . '">' . "<img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;" . $file_row['file_name'] . '
	                </a></td>
	                <td width="20%">' . $file_row['file_description'] . '</td>
	                <td width="5%" nowrap="nowrap" align="center">' . $file_row['file_version'] . '</td>
	                <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=' . $m . '&a=' . $a . '&tab=' . ($file_row['file_category'] + 1) . '">' . $file_types[$file_row['file_category'] + 1] . '</a></td>
	                <td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=' . $file_row["file_task"] . '">' . $row["task_name"] . '</a></td>
	                <td width="15%" nowrap="nowrap">' . $row["contact_first_name"] . ' ' . $row["contact_last_name"] . '</td>
	                <td width="5%" nowrap="nowrap" align="right">' . intval($file_row['file_size'] / 1024) . 'kb </td>
	                <td width="15%" nowrap="nowrap">' . $file_row['file_type'] . '</td>
	                <td width="15%" nowrap="nowrap" align="right">' . $file_date->format("{$df} {$tf}") . '</td>
        			<td width="10%">' . $row['file_co_reason'] . '</td>
        			<td nowrap="nowrap" align="center">';
                    if ($canEdit && empty($file_row['file_checkout'])) {
                        $hidden_table .= '<a href="?m=files&a=co&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file') . '</a>';
                    } else {
                        if ($row['file_checkout'] == $AppUI->user_id) {
                            $hidden_table .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file') . '</a>';
                        } else {
                            if ($file_row['file_checkout'] == 'final') {
                                $hidden_table .= 'final';
                            } else {
                                $q4 = new DBQuery();
                                $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                                $q4->addTable('files');
                                $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                                $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                                $q4->addWhere('file_id = ' . $file_row['file_id']);
                                $co_user = array();
                                $co_user = $q4->loadList();
                                $co_user = $co_user[0];
                                $q4->clear();
                                $hidden_table .= $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                            }
                        }
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="48">';
                    if ($canEdit && (empty($file_row['file_checkout']) || $file_row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file_row["file_id"] . '">' . dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file') . "</a>" . '<a href="#" onclick="document.frm_duplicate_sub_file_' . $file_row['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . "</a>" . '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_delete_sub_file_' . $file_row['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . "</a>";
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="1">';
                    if ($canEdit && (empty($row['file_checkout']) || $row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file_row['file_id'] . ') : removeBulkComponent(' . $file_row['file_id'] . ')"';
                        $hidden_table .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sub_sel_file_' . $file_row['file_id'] . '" />';
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '</tr>';
                }
            }
            $hidden_table .= '</table>';
            //$hidden_table .= '</span>';
        }
        ?>
	        </td>
	        <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=<?php 
        echo $m;
        ?>
&a=<?php 
        echo $a;
        ?>
&view=categories&tab=<?php 
        echo $file['file_category'];
        ?>
"><?php 
        echo $file_types[$file["file_category"]];
        ?>
</a></td> 
		<td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $file["task_id"];
        ?>
"><?php 
        echo $file["task_name"];
        ?>
</a></td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="right"><?php 
        echo intval($file["file_size"] / 1024);
        ?>
 kb</td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["file_type"];
        ?>
</td>
		<td width="15%" nowrap="nowrap" align="right"><?php 
        echo $file_date->format("{$df} {$tf}");
        ?>
</td>
        <td width="10%"><?php 
        echo $file['file_co_reason'];
        ?>
</td>
        <td nowrap="nowrap" align="center">
        <?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
                <a href="?m=files&a=co&file_id=<?php 
            echo $file['file_id'];
            ?>
"><?php 
            echo dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
</a>
        <?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
                <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $file['file_id'];
                ?>
"><?php 
                echo dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
</a>
        <?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo 'final';
                } else {
                    $q4 = new DBQuery();
                    $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                    $q4->addTable('files');
                    $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                    $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                    $q4->addWhere('file_id = ' . $file['file_id']);
                    $co_user = array();
                    $co_user = $q4->loadList();
                    $co_user = $co_user[0];
                    $q4->clear();
                    echo $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                }
            }
        }
        ?>
                
        </td>
		<td nowrap="nowrap" align="center" width="48">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            echo '<a href="./index.php?m=files&a=addedit&file_id=' . $file["file_id"] . '">';
            echo dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
            echo "</a>";
            echo '<a href="#" onclick="document.frm_duplicate_file_' . $file['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . '</a>';
            echo '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $file['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . '</a>';
        }
        ?>
		<td nowrap="nowrap" align="center" width="1">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file['file_id'] . ') : removeBulkComponent(' . $file['file_id'] . ')"';
            echo '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $file['file_id'] . '" />';
        }
        ?>
		
		</td>
	</tr>
	<?php 
        echo $hidden_table;
        ?>
	<?php 
        $hidden_table = '';
    }
    ?>
	</table>
	<?php 
    if ($xpg_totalrecs > $xpg_pagesize) {
        showfnavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder);
    }
    echo "<br />";
}
Ejemplo n.º 21
0
function displayWeeks($list, $task, $level, $fromPeriod, $toPeriod)
{
    //start of week
    $sd = new CDate($fromPeriod);
    $days_from_start = $sd->getDayOfWeek();
    for ($i = 0; $i < $days_from_start; $i++) {
        $stmp = $sd->getPrevDay();
        $sd = new CDate($stmp->format('%Y-%m-%d 00:00:00'));
    }
    //end of week
    $ed = new CDate($toPeriod);
    $days_spent = $ed->getDayOfWeek();
    for ($i = 6 - $days_spent; $i > 0; $i--) {
        $etmp = $ed->getNextDay();
        $ed = new CDate($etmp->format('%Y-%m-%d 23:59:59'));
    }
    $st = new CDate($task->task_start_date);
    $et = new CDate($task->task_end_date);
    $row = '';
    while ($sd->before($ed)) {
        $sd_end = new CDate($sd->format('%Y-%m-%d 00:00:00'));
        $sd_end->addSeconds(7 * 24 * 3600);
        //add one week
        if ($sd->after($st) && $sd_end->before($et) || $st->before($sd_end) && !$st->before($sd) || $et->after($sd) && !$et->after($sd_end)) {
            /*
             * generate visually distiguishable colors for up to 12 task levels
             * Color will just be blue (#0000FF) for levels 12th and up. 
             */
            $red_key = 12 - floor($level / 3) * 3;
            $red_key = $red_key > 15 ? 15 : ($red_key < 0 ? 0 : $red_key);
            $green_key_1 = $red_key + 4 - $level % 3 * 4;
            $green_key_1 = $green_key_1 > 15 ? 15 : ($green_key_1 < 0 ? 0 : $green_key_1);
            $green_key_2 = $green_key_1 == $red_key ? 0 : $green_key_1;
            $color_hex = mb_strtoupper('#' . dechex($red_key) . '0' . dechex($green_key_1) . dechex($green_key_2) . 'FF');
            $row .= '<td nowrap="nowrap" style="background:' . $color_hex . ';" >';
        } else {
            $row .= '<td nowrap="nowrap">';
        }
        $row .= '&nbsp;</td>';
        $sd->addSeconds(7 * 24 * 3600);
        //add one week
    }
    return $row;
}
Ejemplo n.º 22
0
echo $AppUI->_('Date');
?>
</th>
		<th><?php 
echo $AppUI->_('Type');
?>
</th>
		<th><?php 
echo $AppUI->_('Event');
?>
</th>
	</tr>
<?php 
foreach ($events as $row) {
    $start = new CDate($row['event_start_date']);
    $end = new CDate($row['event_end_date']);
    ?>
	<tr>
		<td width="25%" nowrap="nowrap">
			<?php 
    echo $start->format($df . ' ' . $tf);
    ?>
 - <?php 
    echo $end->format($df . ' ' . $tf);
    ?>
		</td>
		<td width="10%" nowrap="nowrap">
			<?php 
    echo dPshowImage(dPfindImage('event' . $row['event_type'] . '.png', 'calendar'), 16, 16, '');
    ?>
			<b><?php 
Ejemplo n.º 23
0
 }
 if (!$end) {
     $end = $start;
     $caption .= $AppUI->_('(no end date)');
 } else {
     $cap = '';
 }
 if ($showLabels) {
     $caption .= $t['project_name'] . ' (' . $t['perc_assignment'] . '%)';
     /*
     $caption .= (($p['project_status']) != 7 ? $AppUI->_('active') : $AppUI->_('inactive'));
     */
 }
 if ($t['task_milestone'] != 1) {
     $enddate = new CDate($end);
     $startdate = new CDate($start);
     $bar = new GanttBar($row++, array($name, $startdate->format($df), $enddate->format($df), ' '), $start, $actual_end, $cap, $t['task_dynamic'] == 1 ? 0.1 : 0.6);
     if (is_file(TTF_DIR . 'FreeSans.ttf')) {
         $bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 10);
     }
     $bar->SetFillColor('#' . $t['project_color_identifier']);
     $bar->SetPattern(BAND_SOLID, '#' . $t['project_color_identifier']);
     //adding captions
     $bar->caption = new TextProperty($caption);
     $bar->caption->Align('left', 'center');
 } else {
     $bar = new MileStone($row++, $name, $start, substr($start, 0, 10));
     $bar->title->SetColor('#CC0000');
 }
 $graph2->Add($bar);
 // If showAllGant checkbox is checked
Ejemplo n.º 24
0
</tr>
<?php 
//get stuff from db
$sql = "SELECT * FROM holiday ";
$sql .= " WHERE holiday_white=0";
$sql .= " ORDER BY holiday_start_date DESC";
$prc = db_exec($sql);
echo db_error();
while ($row = db_fetch_assoc($prc)) {
    ?>
<tr>
	<?php 
    $tmp_start_date = new CDate($row['holiday_start_date']);
    ?>
	<?php 
    $tmp_end_date = new CDate($row["holiday_end_date"]);
    ?>
	<td><a href='<?php 
    echo "?m=holiday&a=addedit&holiday_id=" . $row["holiday_id"];
    ?>
'><img src="./images/icons/pencil.gif" title="<?php 
    echo $AppUI->_('Edit holiday');
    ?>
" border="0" width="12" height="12"></a></td>
	<td><?php 
    echo $row["holiday_description"];
    ?>
</td>
	<td width=100 nowrap="nowrap"><?php 
    echo $tmp_start_date->format($AppUI->getPref('SHDATEFORMAT'));
    ?>
Ejemplo n.º 25
0
				$nomSec=CBdd::select_one($sql_nomSec, 'nom_sec');
				?>
				<div class="bulle">
			         <?php echo utf8_encode($nomSec); ?>
			    </div>			  
			  </td>
			  <td class="zinfo"> <?php 
			  echo $user['categorie_ent'];
				$sql_nomCat='select nom_cat FROM cat WHERE id_cat='.$user['categorie_ent'];
				$nomCat=CBdd::select_one($sql_nomCat, 'nom_cat');
				?>
				<div class="bulle">
			         <?php echo utf8_encode($nomCat); ?>
			    </div>	
			  </td>
              <td align="center"><?php if ($user['dateajout_ent'] != "00-00-0000") echo CDate::date_switch($user['dateajout_ent'])  ?></td>
              <td align="center"><?php echo CHtmlUser::get_etat_contact($user['id_ent'], $user['etat_contact'], 0) ?></td>
              
			            
			  <td style="text-align: center;">
              		<?php echo $opp_num[$user['idopportunite']]; ?>
              		
		      </td>

              <td align="center"><a href="contact.php?a=5&id=<?php echo $user['id_ent'] ?>" target="_parent"><img src="../img/b_edit.png" alt="modifier, afficher" /></a></td>
              <td align="center"><?php echo CHtmlSession::get_delbutton($a, $user['id_ent'], $id, $user['id_ent']) ?></td>
              <td><a href="envoi.php?destinataire=<?php echo $user['email'] ?>&a=4" target="_parent">&gt;&gt;</a></td>
              <td align="center"><?php if(CBdd::select_one("SELECT count(id) AS nb_reponse FROM reponse WHERE iduser = " . $user['id_ent'], 'nb_reponse')) { ?>
                <a href="../src/reponse.php?id=<?php echo $user['id_ent'] ?>" target="popup" onclick="popup(this.href, this.target, '600', '500'); return false;"> >> </a>
                <?php } ?></td>
              <td><input type="checkbox" name="ids[]" class="id_del" value="<?php echo $user['id_ent'] ?>"/></td>
Ejemplo n.º 26
0
if (!$log_all) {
    $sql .= "\n\tAND task_log_date >= '" . $start_date->format(FMT_DATETIME_MYSQL) . "'" . "\n\tAND task_log_date <= '" . $end_date->format(FMT_DATETIME_MYSQL) . "'";
}
if ($log_ignore) {
    $sql .= "\n\tAND task_log_hours > 0";
}
if ($log_userfilter) {
    $sql .= "\n\tAND task_log_creator = {$log_userfilter}";
}
echo $sql;
$proj =& new CProject();
$allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'task_project');
if (count($allowedProjects)) {
    $sql .= "\n     AND " . implode(" AND ", $allowedProjects);
}
$sql .= " ORDER BY task_log_date";
//echo "<pre>$sql</pre>";
$logs = db_loadList($sql);
echo db_error();
$hours = 0.0;
$pdfdata = array();
foreach ($logs as $log) {
    $date = new CDate($log['task_log_date']);
    $hours += $log['task_log_hours'];
    $pdfdata[] = array($log['creator'], $log['task_log_name'], $log['task_log_description'], $date->format($df), sprintf("%.2f", $log['task_log_hours']), $log['task_log_costcode']);
    echo $date->format($df);
    printf("%.2f", $log['task_log_hours']);
}
$pdfdata[] = array('', '', '', $AppUI->_('Total Hours') . ':', sprintf("%.2f", $hours), '');
echo " Total de Horas";
printf("%.2f", $hours);
Ejemplo n.º 27
0
            <th><a href="?">Rang</a></th>
            <th>Publi&eacute;</th>
            <th>Modif</th>
            <th title="suppr"> Suppr </th>
          </tr>
          <?php
		  $i = 0; 
		  while ($article = mysql_fetch_array($r_article)) {		
	      ?>
          <tr>
            <td><a href="?a=5&id=<?php echo $article['id'] ?>"><?php echo $article['id'] ?></a></td>
            <td height><?php echo stripslashes($article['nom']) ?></td>
            <td align="center"><?php echo $article['loginreda'] ?></td>
            <td align="center"><?php echo $article['loginlecteur'] ?></td>
            <td align="center"><?php echo $article['nomcat'] ?></td>
            <td align="center"><?php echo CDate::date_switch(CDate::formate_date($article['date'])) ?></td>
            <td align="center"><?php echo CHtmlSession::get_rang('article', $article['id'], $article['idreda']) ?></td>
            <td align="center"><?php echo CHtmlSession::get_etat($article['id'], $article['etat'], $article['idreda']) ?></td>
            <td align="center"><?php echo CHtmlSession::get_editbutton($article['id'], $article['idreda']) ?></td>
            <td align="center"><?php echo CHtmlSession::get_delbutton($a, $article['id'], $id, $article['idreda']) ?></td>
          </tr>
          <?php } ?>
        </table>
        <?php } ?>

<?php 
//----------------------------------------------------------------------------------------------
// AJOUT
//----------------------------------------------------------------------------------------------
?>
        <?php if($a == 4) { ?>
Ejemplo n.º 28
0
 /**
  * Called by the Event Queue processor to process a reminder
  * on a task.
  * @access		  public
  * @param		 string		   $module		  Module name (not used)
  * @param		 string		   $type Type of event (not used)
  * @param		 integer		$id ID of task being reminded
  * @param		 integer		$owner		  Originator of event
  * @param		 mixed		  $args event-specific arguments.
  * @return		  mixed		   true, dequeue event, false, event stays in queue.
  -1, event is destroyed.
 */
 function remind($module, $type, $id, $owner, &$args)
 {
     global $locale_char_set, $AppUI;
     $q = new DBQuery();
     $df = $AppUI->getPref('SHDATEFORMAT');
     $tf = $AppUI->getPref('TIMEFORMAT');
     // If we don't have preferences set for these, use ISO defaults.
     if (!$df) {
         $df = '%Y-%m-%d';
     }
     if (!$tf) {
         $tf = '%H:%m';
     }
     $df .= ' ' . $tf;
     // At this stage we won't have an object yet
     if (!$this->load($id)) {
         return -1;
         // No point it trying again later.
     }
     $this->htmlDecode();
     // Only remind on working days.
     $today = new CDate();
     if (!$today->isWorkingDay()) {
         return true;
     }
     // Check if the task is completed
     if ($this->task_percent_complete == 100) {
         return -1;
     }
     // Grab the assignee list
     $q->addTable('user_tasks', 'ut');
     $q->leftJoin('users', 'u', 'u.user_id = ut.user_id');
     $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
     $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email');
     $q->addWhere('ut.task_id = ' . $id);
     $contacts = $q->loadHashList('contact_id');
     $q->clear();
     // Now we also check the owner of the task, as we will need
     // to notify them as well.
     $owner_is_not_assignee = false;
     $q->addTable('users', 'u');
     $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
     $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email');
     $q->addWhere('u.user_id = ' . $this->task_owner);
     if ($q->exec(ADODB_FETCH_NUM)) {
         list($owner_contact, $owner_first_name, $owner_last_name, $owner_email) = $q->fetchRow();
         if (!isset($contacts[$owner_contact])) {
             $owner_is_not_assignee = true;
             $contacts[$owner_contact] = array('contact_id' => $owner_contact, 'contact_first_name' => $owner_first_name, 'contact_last_name' => $owner_last_name, 'contact_email' => $owner_email);
         }
     }
     $q->clear();
     // build the subject line, based on how soon the
     // task will be overdue.
     $starts = new CDate($this->task_start_date);
     $expires = new CDate($this->task_end_date);
     $now = new CDate();
     $diff = $expires->dateDiff($now);
     $prefix = $AppUI->_('Task Due', UI_OUTPUT_RAW);
     if ($diff == 0) {
         $msg = $AppUI->_('TODAY', UI_OUTPUT_RAW);
     } else {
         if ($diff == 1) {
             $msg = $AppUI->_('TOMORROW', UI_OUTPUT_RAW);
         } else {
             if ($diff < 0) {
                 $msg = $AppUI->_(array('OVERDUE', abs($diff), 'DAYS'));
                 $prefix = $AppUI->_('Task', UI_OUTPUT_RAW);
             } else {
                 $msg = $AppUI->_(array($diff, 'DAYS'));
             }
         }
     }
     $q->addTable('projects');
     $q->addQuery('project_name');
     $q->addWhere('project_id = ' . $this->task_project);
     $project_name = htmlspecialchars_decode($q->loadResult());
     $q->clear();
     $subject = $prefix . ' ' . $msg . ' ' . $this->task_name . '::' . $project_name;
     $body = $AppUI->_('Task Due', UI_OUTPUT_RAW) . ': ' . $msg . "\n" . $AppUI->_('Project', UI_OUTPUT_RAW) . ': ' . $project_name . "\n" . $AppUI->_('Task', UI_OUTPUT_RAW) . ': ' . $this->task_name . "\n" . $AppUI->_('Start Date', UI_OUTPUT_RAW) . ': ' . $starts->format($df) . "\n" . $AppUI->_('Finish Date', UI_OUTPUT_RAW) . ': ' . $expires->format($df) . "\n" . $AppUI->_('URL', UI_OUTPUT_RAW) . ': ' . DP_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->task_id . '&reminded=1' . "\n\n" . $AppUI->_('Resources', UI_OUTPUT_RAW) . ":\n";
     foreach ($contacts as $contact) {
         if ($owner_is_not_assignee || $contact['contact_id'] != $owner_contact) {
             $body .= $contact['contact_first_name'] . ' ' . $contact['contact_last_name'] . ' <' . $contact['contact_email'] . ">\n";
         }
     }
     $body .= "\n" . $AppUI->_('Description', UI_OUTPUT_RAW) . ":\n" . $this->task_description . "\n";
     $mail = new Mail();
     foreach ($contacts as $contact) {
         if ($mail->ValidEmail($contact['contact_email'])) {
             $mail->To($contact['contact_email']);
         }
     }
     $mail->From('"' . $owner_first_name . ' ' . $owner_last_name . '" <' . $owner_email . '>');
     $mail->Subject($subject, $locale_char_set);
     $mail->Body($body, $locale_char_set);
     return $mail->Send();
 }
Ejemplo n.º 29
0
 // select for tasks for each project
 $q->addTable('tasks', 't');
 $q->addQuery('DISTINCT t.task_id, t.task_name, t.task_start_date, t.task_end_date' . ', t.task_milestone, t.task_dynamic');
 $q->addJoin('projects', 'p', 'p.project_id = t.task_project');
 $q->addWhere('p.project_id = ' . $p['project_id']);
 $q->addOrder($sortTasksByName ? 't.task_name' : 't.task_end_date ASC');
 $tasks = $q->loadList();
 $q->clear();
 foreach ($tasks as $t) {
     if ($t['task_end_date'] == null) {
         $t['task_end_date'] = $t['task_start_date'];
     }
     $tStart = $t['task_start_date'] > '0000-00-00 00:00:00' ? $t['task_start_date'] : $start;
     $tEnd = $t['task_end_date'] > '0000-00-00 00:00:00' ? $t['task_end_date'] : $end;
     $tStartObj = new CDate($tStart);
     $tEndObj = new CDate($tEnd);
     if ($t['task_milestone'] != 1) {
         $bar2 = new GanttBar($row++, array(mb_substr(' --' . $t['task_name'], 0, 20) . '...', $tStartObj->format($df), $tEndObj->format($df), ' '), $tStart, $tEnd, ' ', $t['task_dynamic'] == 1 ? 0.1 : 0.6);
         $bar2->title->SetColor(bestColor('#ffffff', '#' . $p['project_color_identifier'], '#000000'));
         $bar2->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
         $bar2->SetFillColor('#' . $p['project_color_identifier']);
         $graph->Add($bar2);
     } else {
         $bar2 = new MileStone($row++, '-- ' . $t['task_name'], $t['task_start_date'], $tStartObj->format($df));
         $bar2->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
         $bar2->title->SetColor('#CC0000');
         $graph->Add($bar2);
     }
     //Insert workers for each task into Gantt Chart
     $q->addTable('user_tasks', 't');
     $q->addQuery('DISTINCT user_username, t.task_id');
Ejemplo n.º 30
0
function build_date_list(&$date_array, $row)
{
    global $tracked_dynamics, $project;
    // if this task_dynamic is not tracked, set end date to proj start date
    if (!in_array($row['task_dynamic'], $tracked_dynamics)) {
        $date = new CDate($project->project_start_date);
    } elseif ($row['task_milestone'] == 0) {
        $date = new CDate($row['task_end_date']);
    } else {
        $date = new CDate($row['task_start_date']);
    }
    $sdate = $date->format("%d/%m/%Y");
    $shour = $date->format("%H");
    $smin = $date->format("%M");
    $date_array[$row['task_id']] = array($row['task_name'], $sdate, $shour, $smin);
}