function the_event_date() { $end = get_field('end_on'); $is_range = !empty($end); $class = $is_range ? 'range' : ''; echo "<time class='{$class}'>"; display_date(get_field('start_on')); if ($is_range) { echo ' <span class="separator">-</span> '; display_date($end); } echo "</time>"; }
function get_subtasks($parent, $level = 1, $type = "", $where = "", $orderby = "", $bg = "", $preview = false) { //echo "$orderby<br />"; global $db, $slave, $priorities, $parent_task_id, $expand_collapse, $target_path, $total_tasks; if ($orderby != "") { $parent = null; } //if (!is_null($parent)) echo "parent is $parent"; $expand_collapse = array("expand", "collapse"); $creator_id = $_SESSION['user_id']; if ($_SESSION['project_user_id']) { $creator_id = $_SESSION['project_user_id']; } if (($_GET['today'] or $_GET['user_id'] or $_GET['week']) and ($_GET['action'] != "complete" and $_GET['action'] != "log")) { $where2 = "LEFT OUTER JOIN Task_Acknowledgement as A ON T.Task_ID=A.Task_ID WHERE (A.Accepted=1 OR T.Creator_ID=" . $creator_id . ") AND "; } else { $where2 = "LEFT OUTER JOIN Task_Acknowledgement as A ON T.Task_ID=A.Task_ID WHERE "; } //$where2="WHERE "; if (!is_null($parent)) { if (strlen($where) == 4) { $where = ""; } if ($parent === 0) { if ($_GET['assign']) { $where2 = $where2 . "(Parent_Task_ID={$parent} OR Parent_Task_ID NOT IN (SELECT Task_ID FROM Tasks as T2 LEFT OUTER JOIN User_Departments as D2 ON T2.Department_ID=D2.Department_ID LEFT OUTER JOIN Users as L2 ON D2.User_ID=L2.User_ID WHERE " . str_replace(".", "2.", substr($where, 4)) . ")) {$where}"; } else { $where2 = $where2 . "(Parent_Task_ID={$parent} OR Parent_Task_ID NOT IN (SELECT Task_ID FROM Tasks as T2 LEFT OUTER JOIN User_Departments as D2 ON T2.Department_ID=D2.Department_ID LEFT OUTER JOIN Users as U2 ON D2.User_ID=U2.User_ID WHERE " . str_replace(".", "2.", substr($where, 4)) . ")) {$where}"; } } else { $where2 = $where2 . "Parent_Task_ID={$parent} {$where}"; } } else { $where2 = $where2 . substr($where, 4); } //$where2=$where2."T.Task_ID NOT IN (SELECT Parent_Task_ID FROM Tasks) $where"; //if (is_null($parent) AND $subtasks[$t]['Parent_Task_ID']>0) if ($type == "complete" and $orderby == "") { $orderby = "Log_date DESC, Task_Name"; } //else if ($orderby=="" and $parent==0) $orderby="Task_Name"; //else if ($orderby!="") $orderby=$orderby." Task_Name"; if ($orderby and !strstr($orderby, "Task_Name")) { $orderby = "ORDER BY " . $orderby . " Task_Name"; } if ($orderby and !strstr($orderby, "ORDER BY")) { $orderby = "ORDER BY " . $orderby; } if (!$orderby and $parent == 0) { $orderby2 = "ORDER BY Finish_Date IS NULL, Finish_Date"; } if (!strstr($where, "L.User_ID")) { $log = "AND L.Log_Progress=100"; } if (strstr($orderby, "Request_Username")) { $orderby = str_replace("Request_Username", "RL.Username", $orderby); $query = "SELECT T.*, Project_Name, Log_Date, AD.Department_Name as Affected_Department_Name, RL.Username FROM Login as RL, Users as U, Tasks as T LEFT OUTER JOIN Departments as AD ON T.Affected_Department=AD.Department_ID LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID {$log} LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Departments as M ON D.Department_ID=M.Department_ID LEFT OUTER JOIN Login as G ON T.User_ID=G.User_ID {$where2} AND U.User_ID=T.Request_User_ID AND U.User_ID=RL.User_ID GROUP BY T.Task_ID {$orderby} {$orderby2}"; //echo $query; } elseif (strstr($orderby, "Username")) { $query = "SELECT T.*, Project_Name, Log_Date, AD.Department_Name as Affected_Department_Name FROM Tasks as T LEFT OUTER JOIN Departments as AD ON T.Affected_Department=AD.Department_ID LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID {$log} LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Departments as M ON D.Department_ID=M.Department_ID LEFT OUTER JOIN Users as U ON D.User_ID=U.User_ID LEFT OUTER JOIN Login as G ON T.User_ID=G.User_ID {$where2} GROUP BY T.Task_ID {$orderby} {$orderby2}"; } else { $query = "SELECT T.*, Project_Name, Log_Date, AD.Department_Name as Affected_Department_Name FROM Tasks as T LEFT OUTER JOIN Departments as AD ON T.Affected_Department=AD.Department_ID LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID {$log} LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON D.User_ID=U.User_ID {$where2} GROUP BY T.Task_ID {$orderby} {$orderby2}"; } //echo $query; //exit; $subtasks = $slave->select($query); //where parents are not assigned to user if (is_null($parent)) { $query = "SELECT T.*, Project_Name, Log_Date, AD.Department_Name as Affected_Department_Name FROM Tasks as T LEFT OUTER JOIN Departments as AD ON T.Affected_Department=AD.Department_ID LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID {$log} LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON D.User_ID=U.User_ID {$where2} GROUP BY T.Task_ID {$orderby} {$orderby2}"; } /* $query="SELECT T.*, Project_Name, Log_Date FROM Tasks as T LEFT OUTER JOIN Projects as P ON T.Project_ID=P.Project_ID LEFT OUTER JOIN Task_Logs as L ON T.Task_ID=L.Task_ID $log LEFT OUTER JOIN User_Departments as D ON T.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON D.User_ID=U.User_ID $where2 AND Finish_Date IS NULL GROUP BY T.Task_ID ORDER BY $orderby Task_Name"; $subtasks2 = $slave->select($query); if ($subtasks2) { if ($subtasks) $subtasks=array_merge($subtasks,$subtasks2); else $subtasks=$subtasks2; } */ //if ($_SESSION['user_id']==6) print_r($subtasks); $expand = true; if ($level == 0 and $type != "option") { if ($type == "date") { echo "<form action=\"tasks.php\" method=\"GET\" onSubmit=\"this.today.value=this.today.value.replace(/(\\d\\d)\\/(\\d\\d)\\/(\\d\\d\\d\\d)/, '\$3-\$1-\$2')\">\n"; echo "View Date <input name=\"today\" type=\"text\" value=\"" . display_date($_GET['today']) . "\" onfocus=\"this.select();lcs(this)\" onclick=\"event.cancelBubble=true;this.select();lcs(this)\"/>"; echo "<input type=\"submit\" value=\"Go\">"; echo "</form>\n"; } if ($type != "complete") { echo "<div id=\"expand\">"; $expand = false; if ($_SESSION['expand']['all'] == 1) { echo "<a href=\"" . clean_url($expand_collapse) . "expand=none\"><img src=\"" . CDN . "img/collapse.png\" alt=\"Collapse\" /></a>"; } else { echo "<a href=\"" . clean_url($expand_collapse) . "expand=all\"><img src=\"" . CDN . "img/expand.png\" alt=\"Expand\" /></a>"; } echo " all</div>\n"; } } if ($subtasks) { if ($level == 0 and $type != "option") { echo "<table><tr>"; //if ($type!="complete") echo "<th><a href=".get_order_url('T.Progress',$dir).">Work</a></th>"; echo "<th> </th>"; echo "<th><a href=" . get_order_url('T.Priority', $dir) . ">Severity</a></th>"; echo "<th><a href=" . get_order_url('T.Task_ID', $dir) . ">ID</a></th>"; echo "<th><a href=" . get_order_url('Task_Name', $dir) . ">Task</a></th>"; echo "<th><a href=" . get_order_url('Project_Name', $dir) . ">Project</a></th>"; echo "<th><a href=" . get_order_url('Affected_Department_Name', $dir) . ">Department</a></th>"; echo "<th>File</th>"; echo "<th><a href=" . get_order_url('Username', $dir) . ">Assigned</a></th>"; echo "<th>Last</th>"; echo "<th><a href=" . get_order_url('Request_Username', $dir) . ">Request</a></th>"; echo "<th nowrap><a href=" . get_order_url('T.Request_Date', $dir) . ">Req Date</a></th>"; if ($type == "complete") { echo "<th><a href=" . get_order_url('L.Log_Date', $dir) . ">Completed</a></th>"; } else { echo "<th><a href=" . get_order_url('T.Finish_Date', $dir) . ">Due</a></th>"; } if ($type != "complete") { echo "<th>Days</th>"; } echo "</tr>\n"; } $space = str_repeat(' ', $level); $ptid = 0; for ($t = 0; $t < count($subtasks); $t++) { $total_tasks[$priorities[$subtasks[$t]['Priority']]['Name']]++; if ($type != "option" and $type != "complete" and (is_null($parent) or $parent === 0) and $subtasks[$t]['Parent_Task_ID'] > 0 and $subtasks[$t]['Parent_Task_ID'] != $ptid) { $ptid = $subtasks[$t]['Parent_Task_ID']; echo "<tr {$bg} class=\"gray\">"; echo "<td> </td>"; echo "<td> </td>"; echo "<td> </td>"; echo "<td colspan=\"10\"><small>"; get_parent($ptid, true); echo "</small></td>"; echo "</tr>\n"; } else { $ptid = $subtasks[$t]['Parent_Task_ID']; } $small_img = $use_file = ""; $expand = false; if ($preview == true or !$_SESSION['expand'] or $_SESSION['expand']['all'] == 1 and (!isset($_SESSION['expand'][$subtasks[$t]['Task_ID']]) or $_SESSION['expand'][$subtasks[$t]['Task_ID']] != 0) or $_SESSION['expand']['all'] == 0 and $_SESSION['expand'][$subtasks[$t]['Task_ID']] == 1) { $expand = true; } if ($type == "option") { echo "<option value=\"" . $subtasks[$t]['Task_ID'] . "\""; if ($subtasks[$t]['Task_ID'] == $parent_task_id) { echo " selected"; } echo ">" . $space . $subtasks[$t]['Task_Name'] . "</option>\n"; } else { $num_sub = 0; $percent_sub = $subtasks[$t]['Progress']; if ($type == "complete") { $finish_date = $subtasks[$t]['Log_Date']; } else { $finish_date = $subtasks[$t]['Finish_Date']; } //if (!is_null($parent)) list($num_sub, $percent_sub, $finish_date) = get_percent($subtasks[$t]['Task_ID'], $num_sub, $percent_sub, $finish_date); //$finish_date=$subtasks[$t]['Finish_Date']; //if ($subtasks[$t]['Log_Date']) $finish_date=$subtasks[$t]['Log_Date']; //if ($level==0) { // if ($t%2==0) $bg="class=\"highlight\""; // else $bg=""; //} //$haschildren=$slave->select("SELECT * FROM Tasks WHERE Parent_Task_ID=".$subtasks[$t]['Task_ID']); //$users=$slave->select("SELECT IF (UD.User_ID IS NOT NULL, UD.User_ID, U.User_ID) AS User_ID, Username, U.First_Name, U.Last_Name, Department_Name FROM Task_Users as T LEFT OUTER JOIN User_Departments as UD ON T.Department_ID=UD.Department_ID AND UD.User_ID=6 LEFT OUTER JOIN Departments as D ON UD.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON T.User_ID=U.User_ID AND U.User_ID=6 LEFT OUTER JOIN Login as L ON U.User_ID=L.User_ID WHERE Task_ID=".$subtasks[$t]['Task_ID']." ORDER BY IF (Department_Name IS NOT NULL, Department_Name, Username)"); //if ((!$haschildren AND $user) OR ($haschildren)) { echo "<tr {$bg}>"; //if ($type!="complete") { echo "<td align='right' nowrap>"; if (!$preview and $num_sub > 0) { //echo number_format($percent_sub/$num_sub,1)."% "; if ($expand == true) { echo "<a href=\"" . clean_url($expand_collapse) . "collapse=" . $subtasks[$t]['Task_ID'] . "\" class=\"expand\"><img src=\"" . CDN . "img/collapse.png\" alt=\"Collapse\" /></a>"; } else { echo "<a href=\"" . clean_url($expand_collapse) . "expand=" . $subtasks[$t]['Task_ID'] . "\" class=\"expand\"><img src=\"" . CDN . "img/expand.png\" alt=\"Expand\" /></a>"; } } //else if ($type=="complete") echo $percent_sub."%"; //else echo $percent_sub."%"; //if ($percent_sub<100) echo " | <a href=\"tasks.php?work=".$subtasks[$t]['Task_ID']."\">Add</a>"; echo "</td>"; //} if ($preview) { echo "<td></td><td></td>\n"; } else { echo "<td nowrap><small>"; if ($subtasks[$t]['High_Priority']) { echo "<img src=\"" . CDN . "img/fire.png\" alt=\"High Priority\" />\n"; } echo $subtasks[$t]['Priority'] . " " . $priorities[$subtasks[$t]['Priority']]['Name'] . "</small></td>"; echo "<td><small>" . $subtasks[$t]['Task_ID'] . "</small></td>"; } echo "<td>"; if ($preview) { echo "<small>"; } if ($type != "complete" and $level > 0) { echo "{$space} - "; } elseif (is_null($parent) and $subtasks[$t]['Parent_Task_ID'] > 0) { echo "{$space} - "; //echo "…"; } echo "<a href=\"tasks.php?task_id=" . $subtasks[$t]['Task_ID'] . "\""; if ($subtasks[$t]['Parent_Task_ID'] > 0) { $pname = $slave->select("SELECT Task_Name FROM Tasks WHERE Task_ID=" . $subtasks[$t]['Parent_Task_ID']); echo "title=\"" . $pname[0]['Task_Name'] . "\""; } if ($subtasks[$t]['Progress'] == 100) { echo "><strike>" . $subtasks[$t]['Task_Name'] . "</strike></a>"; } else { echo ">" . $subtasks[$t]['Task_Name'] . "</a>"; } //get_child($subtasks[$t]['Task_ID'],true); if ($preview) { echo "</small>"; } echo "</td>"; echo "<td nowrap>"; if ($subtasks[$t]['Project_ID']) { echo "<small><a href=\"projects.php?project_id=" . $subtasks[$t]['Project_ID'] . "\">" . $subtasks[$t]['Project_Name'] . "</a></small></td>"; } else { echo "<small>Non Project Ticket</small>"; } echo "</td>"; echo "<td nowrap><small>"; if ($subtasks[$t]['Affected_Department'] > 0) { //$afdep=$slave->select("SELECT Department_Name FROM Departments WHERE Department_ID=".$subtasks[$t]['Affected_Department']); echo $subtasks[$t]['Affected_Department_Name']; } else { echo "No Department"; } echo "</small></td>"; echo "<td align=\"center\">"; /* if ($handle = opendir($target_path)) { while (false !== ($file = readdir($handle))) { if (preg_match('/^'.$subtasks[$t]['Task_ID'].'.+/',$file)) { if (strstr($file,'_sm.jpg')) $small_img=$file; else $use_file=$file; } } closedir($handle); } else echo "could not open"; if ($small_img) echo "<a href=\"${target_path}$use_file\" target=\"_blank\"><img src=\"".CDN."img/icons/111.png\" border=0 /></a>"; else if ($use_file) echo "<a href=\"${target_path}$use_file\" target=\"_blank\"><img src=\"".CDN."img/icons/3.png\" border=0 /></a>"; */ $files = $slave->select("SELECT * FROM Files as F, File_Types as T WHERE F.File_Type_ID=T.File_Type_ID AND Task_ID=" . $subtasks[$t]['Task_ID'] . " ORDER BY Image"); if ($files) { $img = $multi = ""; foreach ($files as $f) { if ($img != $f['Image'] or $img == 0) { $img = $f['Image']; if ($f['Image'] == 1) { $icon = "111.png"; echo "<a href=\"" . CDN . "img.php?id=" . $subtasks[$t]['Task_ID'] . "\" alt=\"\" target=\"_blank\"><img src=\"" . CDN . "img/icons/{$icon}\" border=0 /></a>"; } else { $icon = "3.png"; echo "<a href=\"{$target_path}" . $f['File_ID'] . "." . $f['Extention'] . "\" alt=\"\" target=\"_blank\"><img src=\"" . CDN . "img/icons/{$icon}\" border=0 /></a>"; } } elseif ($img == 1) { $mult = "+"; } } echo $mult; } echo "</td>"; echo "<td><small>"; $users = $slave->select("SELECT IF (UD.User_ID IS NOT NULL, UD.User_ID, U.User_ID) AS User_ID, Username, U.First_Name, U.Last_Name, Department_Name FROM Tasks as T LEFT OUTER JOIN User_Departments as UD ON T.Department_ID=UD.Department_ID LEFT OUTER JOIN Departments as D ON UD.Department_ID=D.Department_ID LEFT OUTER JOIN Users as U ON T.User_ID=U.User_ID LEFT OUTER JOIN Login as L ON U.User_ID=L.User_ID WHERE Task_ID=" . $subtasks[$t]['Task_ID'] . " ORDER BY IF (Department_Name IS NOT NULL, Department_Name, Username)"); if ($users) { $dep = ""; for ($u = 0; $u < count($users); $u++) { if ($u > 0 && ($users[$u]['Department_Name'] == "" or $users[$u]['Department_Name'] != $dep)) { echo ", "; } if ($users[$u]['Department_Name']) { if ($users[$u]['Department_Name'] != $dep) { $dep = $users[$u]['Department_Name']; echo $users[$u]['Department_Name']; } } else { echo $users[$u]['Username']; } } } else { echo "none"; } echo "</small></td>"; echo "<td><small>"; $users = $slave->select("SELECT U.User_ID, Username, U.First_Name, U.Last_Name FROM Tasks as T, Task_Logs as L, Users as U, Login as O WHERE T.Task_ID=L.Task_ID AND L.User_ID=U.User_ID AND O.User_ID=U.User_ID AND T.Task_ID=" . $subtasks[$t]['Task_ID'] . " ORDER BY Log_ID DESC LIMIT 1"); if (!$users) { $users = $slave->select("SELECT U.User_ID, Username, U.First_Name, U.Last_Name FROM Tasks as T, Users as U, Login as O WHERE T.Creator_ID=U.User_ID AND O.User_ID=U.User_ID AND T.Task_ID=" . $subtasks[$t]['Task_ID']); } if ($users) { echo $users[0]['Username']; } else { echo "none"; } echo "</small></td>"; echo "<td><small>"; $users = $slave->select("SELECT U.User_ID, Username, U.First_Name, U.Last_Name FROM Tasks as T, Users as U, Login as L WHERE U.User_ID=L.User_ID AND T.Request_User_ID=U.User_ID AND Task_ID=" . $subtasks[$t]['Task_ID']); if ($users) { echo $users[0]['Username']; } else { echo "none"; } echo "</small></td>"; if (display_date($subtasks[$t]['Request_Date']) == "00/00/0000" or display_date($subtasks[$t]['Request_Date']) == "NULL") { echo "<td>Not Set</td>"; } else { echo "<td><small>" . display_date($subtasks[$t]['Request_Date']) . "</small></td>"; } //echo "<td>".$subtasks[$t]['Durration']."</td>"; //$isparent=$slave->select("SELECT Task_ID FROM Tasks WHERE Parent_Task_ID=".$subtasks[$t]['Task_ID']); //if ($isparent) { // echo "<td> </td>"; //} else if (display_date($finish_date) == "NULL") { echo "<td><small>Not Set</small></td>"; if ($type != "complete") { echo "<td>-</td>"; } } else { echo "<td><small>" . display_date($finish_date) . "</small></td>"; if ($type != "complete" and $subtasks[$t]['Progress'] < 100) { echo "<td><small>" . dateDiff(date("Y-m-d"), $finish_date) . "</small></td>"; } } echo "</tr>\n"; if ($expand == true and ($_GET['today'] or $_GET['week']) and !isset($parent_task_id)) { get_subtasks($subtasks[$t]['Task_ID'], $level + 1, "", "AND T.Progress<100", "", "class=\"gray\"", true); } if ($expand == true and $parent === 0) { get_subtasks($subtasks[$t]['Task_ID'], $level + 1, "", "AND T.Progress<100 AND NOT (T.User_ID=" . $_SESSION['user_id'] . " OR U.User_ID=" . $_SESSION['user_id'] . ")", "", "class=\"gray\"", true); } //} } if ($expand === true and !is_null($parent) and !$preview) { get_subtasks($subtasks[$t]['Task_ID'], $level + 1, $type, $where, $orderby, $bg); } //if ($add=="no") //$space=str_replace('/ $/','',$space); } if ($level == 0 and $type != "option") { echo "</table>"; echo "<p>"; $totaltt = 0; foreach ($total_tasks as $tk => $tv) { echo "Total {$tk} Tasks: {$tv}<br />"; $totaltt = $totaltt + $tv; } echo "Grand Total: {$totaltt}"; echo "</p>\n"; } } else { if ($level == 0 and $type != "option") { echo "<h2 align=\"center\">No Tasks</h2>"; } return false; } }
/** * Function creates HTML to display Calendar Header and its Links * @param array $header - collection of objects and strings * @param string $viewBox - string 'listview' or 'hourview' or may be empty. if 'listview' means Events ListView.if 'hourview' means Events HourView. if empty means get Todos ListView * @param string $subtab - string 'todo' or 'event'. if 'todo' means Todos View else Events View */ function get_cal_header_tab(&$header, $viewBox, $subtab) { global $mod_strings, $cal_log; $category = getParentTab(); $cal_log->debug("Entering get_cal_header_tab() method..."); $tabhtml = ""; $count = 1; include_once 'modules/Calendar/addEventUI.php'; include_once 'modules/Calendar/header.php'; $eventlabel = $mod_strings['LBL_EVENTS']; $todolabel = $mod_strings['LBL_TODOS']; $div = "<div id='miniCal' style='width:300px; position:absolute; display:none; left:100px; top:100px; z-index:100000; background-color:white'></div>\n\t\t<div id='calSettings' class='layerPopup calSettings' style='display:none;width:500px;' align=center ></div>\n\t\t<div id='dataArray'></div>\n\t\t"; echo $div; $tabhtml .= "<table class='small calHdr' align='center' border='0' cellpadding='5' cellspacing='0' width='100%'><tr>"; $links = array('day', 'week', 'month', 'year'); //To differentiate the selected link from unselected links foreach ($links as $link) { if ($header['view'] == $link) { $class = 'calSel'; $anchor = $mod_strings["LBL_" . $header['calendar']->getCalendarView($link)]; } else { $class = 'calUnSel'; $anchor = "<a href='index.php?module=Calendar&action=index&view=" . $link . "" . $header['calendar']->date_time->get_date_str() . "&viewOption=" . $viewBox . "&subtab=" . $subtab . "&parenttab=" . $category . "'>" . $mod_strings["LBL_" . $header['calendar']->getCalendarView($link)] . "</a>"; } if ($count == 1) { $tabhtml .= "<!-- day week month buttons --> <td style='border-left: 1px solid #666666;' class=" . $class . ">" . $anchor . "</td>"; } else { $tabhtml .= "<td class=" . $class . ">" . $anchor . "</td>"; } $count++; } //To get Navigation(next&previous) links and display Date info $tabhtml .= "<td width='30%'>\n\t\t\t<table border='0' cellpadding='0' cellspacing='0'>\n\t\t\t<tr>\n\t\t\t\t<td>" . get_previous_cal($header, $viewBox, $subtab) . "\n\t\t\t\t</td>"; $tabhtml .= "<td class='calendarNav'>" . display_date($header['view'], $header['calendar']->date_time) . "</td>"; $tabhtml .= "<td>" . get_next_cal($header, $viewBox, $subtab) . "\n\t\t </td></tr>\n\t\t </table>\n\t\t</td>"; $tabhtml .= "<td width='2%'><img onClick='fnvshobj(this,\"miniCal\"); getMiniCal(\"view=" . $header['calendar']->view . "" . $header['calendar']->date_time->get_date_str() . "&viewOption=" . $viewBox . "&subtab=" . $subtab . "&parenttab=" . $category . "\");' src='" . $header['IMAGE_PATH'] . "btnL3Calendar.gif' alt='" . $mod_strings['LBL_OPENCAL'] . "...' title='" . $mod_strings['LBL_OPENCAL'] . "...' align='absmiddle' border='0'></td>"; $tabhtml .= "<td width=20% ><img onClick='fnvshobj(this,\"calSettings\"); getCalSettings(\"view=" . $header['calendar']->view . "" . $header['calendar']->date_time->get_date_str() . "&viewOption=" . $viewBox . "&subtab=" . $subtab . "&parenttab=" . $category . "\");' src='" . $header['IMAGE_PATH'] . "tbarSettings.gif' alt='" . $mod_strings['LBL_SETTINGS'] . "' title='" . $mod_strings['LBL_SETTINGS'] . "' align='absmiddle' border='0'></td>"; $tabhtml .= "<td class='calHdr calTopRight componentName'>" . $app_strings['Calendar'] . "</td>"; $tabhtml .= "</tr>"; echo $tabhtml; $cal_log->debug("Exiting get_cal_header_tab() method..."); }
/** * Save a data source * * * @author Minh Duc Nguyen <*****@*****.**> * @param [POST] Data Source ID [POST] attributes * @todo ACL on which data source you have access to, error handling, new attributes * @return [JSON] result of the saving [VOID] */ public function updateDataSource() { set_exception_handler('json_exception_handler'); $jsonData = array(); $dataSource = NULL; $id = NULL; $jsonData['status'] = 'OK'; $POST = $this->input->post(); //print("<pre>"); //print_r($POST); //print("</pre>"); if (isset($POST['data_source_id'])) { $id = (int) $this->input->post('data_source_id'); } $this->load->model("data_sources", "ds"); $this->load->model("registry_object/registry_objects", "ro"); if ($id == 0) { $jsonData['status'] = "ERROR"; $jsonData['message'] = "Invalid data source ID"; } else { $dataSource = $this->ds->getByID($id); } // ACL enforcement acl_enforce('REGISTRY_USER'); ds_acl_enforce($id); $resetHarvest = false; $resetPrimaryRelationships = false; // reindex all records if the primary relationship information has changed! // XXX: This doesn't handle "new" attribute creation? Probably need a whilelist to allow new values to be posted. //**whitelist**// if ($dataSource) { $valid_attributes = array_merge(array_keys($dataSource->attributes()), array_keys($dataSource->harvesterParams)); $valid_attributes = array_merge($valid_attributes, $dataSource->primaryRelationship); $valid_attributes = array_merge($valid_attributes, array_keys($dataSource->stockAttributes)); $valid_attributes = array_merge($valid_attributes, array_keys($dataSource->extendedAttributes)); $valid_attributes = array_unique($valid_attributes); foreach ($valid_attributes as $attrib) { $new_value = null; if (is_integer($attrib) && $attrib == 0) { continue; } else { if (isset($POST[$attrib])) { $new_value = trim($this->input->post($attrib)); } else { if (in_array($attrib, array_keys($dataSource->harvesterParams))) { $new_value = $dataSource->harvesterParams[$attrib]; } else { if (in_array($attrib, $dataSource->primaryRelationship)) { $new_value = ''; } } } } if ($new_value == 'true') { $new_value = DB_TRUE; } if ($new_value == 'false') { $new_value = DB_FALSE; } if ($attrib == 'uri') { $providerURI = $new_value; } // If primary relationships are disabled, unset all the relationship settings if ($this->input->post('create_primary_relationships') == 'false') { switch ($attrib) { case 'primary_key_1': case 'service_rel_1': case 'activity_rel_1': case 'collection_rel_1': case 'party_rel_1': case 'primary_key_2': case 'service_rel_2': case 'activity_rel_2': case 'collection_rel_2': case 'party_rel_2': $new_value = ''; break; default: break; } } if ($this->input->post('primary_key_2') == '') { switch ($attrib) { case 'primary_key_2': case 'service_rel_2': case 'activity_rel_2': case 'collection_rel_2': case 'party_rel_2': $new_value = ''; break; default: break; } } if ($this->input->post('primary_key_1') == '') { switch ($attrib) { case 'primary_key_1': case 'service_rel_1': case 'activity_rel_1': case 'collection_rel_1': case 'party_rel_1': $new_value = ''; break; default: break; } } /* this push to nla functionality has been removed as NLA aren't using it and the ds admins were getting confused if($this->input->post('push_to_nla')=='false') { switch($attrib){ case 'isil_value': $new_value = ''; break; default: break; } } */ //echo $attrib." is the attribute"; if ($new_value != $dataSource->{$attrib} && in_array($attrib, array_keys($dataSource->harvesterParams))) { //var_dump(array($attrib, $dataSource->{$attrib}, $new_value)); $resetHarvest = true; } if ($new_value != $dataSource->{$attrib} && in_array($attrib, $dataSource->primaryRelationship)) { $resetPrimaryRelationships = true; } //we need to check if we have turned it on or off and then change record statuses accordingly if ($new_value == 'f' && $attrib == 'qa_flag' && $new_value != $dataSource->{$attrib}) { $jsonData['qa_flag'] = "changed from " . $dataSource->{$attrib} . " to " . $new_value; $newStatus = PUBLISHED; $manual_publish = $this->input->post('manual_publish'); if ($manual_publish == "true" || $manual_publish == "t") { $newStatus = APPROVED; } //get all objects with submitted for assessment status for this ds and change status to the new status $ros = ''; $ros = $this->ro->getByAttributeDatasource($dataSource->id, 'status', SUBMITTED_FOR_ASSESSMENT, true); $jsonData['ros'] = $ros; if ($ros) { foreach ($ros as $submitted_ro) { $ro = $this->ro->getByID($submitted_ro->id); $jsonData[$submitted_ro->id] = $ro->status; $ro->status = $newStatus; $ro->save(); } } //get all objects with assessment in progress status for this ds and change status to the new status $roa = ''; $roa = $this->ro->getByAttributeDatasource($dataSource->id, 'status', ASSESSMENT_IN_PROGRESS, true); $jsonData['roa'] = $roa; if ($roa) { foreach ($roa as $progress_ro) { $ro = $this->ro->getByID($progress_ro->id); $jsonData[$progress_ro->id] = $ro->status; $ro->status = $newStatus; $ro->save(); } } } //we need to check if we have turned manually publish to NO - if so set all records of this datasource from Approved to Published if ($attrib == 'manual_publish' && $new_value == 'f' && $new_value != $dataSource->{$attrib}) { $jsonData['manual_publish'] = "changed from " . $dataSource->{$attrib} . " to " . $new_value; //so lets get all of the objects for this ds that have a status of "Approved" nad change the status to published $jsonData['ds_id'] = $dataSource->id; $rop = ''; $rop = $this->ro->getByAttributeDatasource($dataSource->id, 'status', APPROVED, true); $jsonData['rop'] = $rop; if ($rop) { foreach ($rop as $approved_ro) { $ro = $this->ro->getByID($approved_ro->id); $ro->status = PUBLISHED; $ro->save(); } } } if (!is_null($new_value)) { $changed = $new_value !== $dataSource->{$attrib}; $dataSource->{$attrib} = $new_value; } $dataSource->updateStats(); } $dataSource->save(); $dataSource->append_log("The data source settings were updated..." . NL . NL . "Data Source was updated by: " . $this->user->name() . " (" . $this->user->localIdentifier() . ") at " . display_date()); if ($resetHarvest && ($providerURI != '' || $providerURI != 'http://')) { $dataSource->requestNewHarvest(); } if ($resetPrimaryRelationships) { $dataSource->reindexAllRecords(); } } //$jsonData['attributes'] = $dataSource->attributes(); $jsonData = json_encode($jsonData); echo $jsonData; }
//show all products $projects = $slave->select("SELECT S.*,P.*, O.Location_Name, C.Company_Name as Internal, M.Company_Name, CONCAT(U.First_Name,' ',U.Last_Name) as Owner FROM Projects as P LEFT OUTER JOIN Clients as L ON P.Client_ID=L.Client_ID LEFT OUTER JOIN Company_Locations as O ON L.Company_Location_ID=O.Company_Location_ID LEFT OUTER JOIN Companies as M ON L.Company_ID=M.Company_ID, Companies as C, Project_Status as S, Users as U WHERE P.Owner_ID=U.User_ID AND P.Status_ID=S.Status_ID AND P.Company_ID=C.Company_ID ORDER BY Target_End_Date ASC"); if ($projects) { echo "<table><tr><th>Project Name</th><th>Company</th><th>Client</th><th>Start</th><th>End</th><th>Actual</th><th>Priority</th><th>Owner</th><th>Tasks (My)</th><th>Status</th></tr>"; for ($y = 0; $y < count($projects); $y++) { echo "<tr>"; echo "<td><a href=\"projects.php?project_id=" . $projects[$y]['Project_ID'] . "\">" . $projects[$y]['Project_Name'] . "</a></td>"; echo "<td>" . $projects[$y]['Internal'] . "</td>\n"; echo "<td>" . $projects[$y]['Company_Name']; if ($projects[$y]['Location_Name']) { echo " (" . $clients[$y]['Location_Name'] . ")"; } echo " - " . $projects[$y]['Contact_Name'] . "</td>"; echo "<td>" . display_date($projects[$y]['Start_Date']) . "</td>"; echo "<td>" . display_date($projects[$y]['Target_End_Date']) . "</td>"; echo "<td>" . display_date($projects[$y]['Actual_End_Date']) . "</td>"; echo "<td>" . $priorities[$projects[$y]['Priority']] . "</td>"; echo "<td>" . $projects[$y]['Owner'] . "</td>"; //tasks $tasks = $slave->select("SELECT COUNT(Task_ID) as Count FROM Tasks WHERE Project_ID=" . $projects[$y]['Project_ID']); $mytasks = $slave->select("SELECT COUNT(User_ID) as Count FROM Tasks as T WHERE T.User_ID=" . $_SESSION['user_id'] . " AND Project_ID=" . $projects[$y]['Project_ID']); echo "<td><a href=\"tasks.php?project_id=" . $projects[$y]['Project_ID'] . "\">" . $tasks[0]['Count'] . " (" . $mytasks[0]['Count'] . ")</a></td>"; echo "<td>" . $projects[$y]['Status_Name'] . "</td>"; echo "</tr>"; } echo "</table>"; } else { echo "<p>No Projects, please add New Project</p>\n"; } } show_foot();
echo la_casa_edit_data_gen_input($participant->move_in_address, 'move_in_address_edit', 'edit_term constant'); ?> </td> </tr> <tr> <td><strong>Move In Note </strong></td> <td> <?php echo $participant->move_in_note; echo la_casa_edit_data_gen_input($participant->move_in_note, 'move_in_note_edit', 'edit_term constant'); ?> </td> </tr> <tr> <td><strong>Orientation Date </strong></td> <td> <?php echo display_date($participant->orientation_date); echo la_casa_edit_data_gen_input($participant->orientation_date, 'orientation_date_edit', 'edit_term constant date_popout', '(mm/dd/yyyy)'); ?> </td> </tr> <tr> <td><strong>Orientation Time </strong></td> <td> <?php echo $participant->orientation_time; echo la_casa_edit_data_gen_input($participant->orientation_time, 'orientation_time_edit', 'edit_term constant'); ?> </td> </tr> <tr> <td> <input type="button" value="Edit" onclick="$('.edit_term.constant').toggle()">
/** * Function creates HTML to display small(mini) Calendar * @param array $cal - collection of objects and strings */ function get_its_mini_calendar(&$cal) { global $current_user, $adb, $mod_strings, $theme; $category = getParentTab(); $count = 0; //To decide number of rows(weeks) in a month if ($cal['calendar']->month_array[$cal['calendar']->slices[35]]->start_time->month != $cal['calendar']->date_time->month) { $rows = 5; } else { $rows = 6; } $minical = ""; $minical .= "<table class='mailClient ' bgcolor='white' border='0' cellpadding='2' cellspacing='0' width='98%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='calHdr'> </td>\n\t\t\t\t\t<td style='padding:5px' colspan='6' class='calHdr' align='center'>" . get_previous_its_cal($cal) . " "; $minical .= "<a style='text-decoration: none;' href='javascript:changeCalendarMonthDate(" . $cal['calendar']->date_time->year . "," . $cal['calendar']->date_time->month . "," . $cal['calendar']->date_time->day . ");'><b>" . display_date($cal['view'], $cal['calendar']->date_time) . "</b></a> " . get_next_its_cal($cal) . "</td>"; //$minical .= "<a style='text-decoration: none;' href='index.php?module=Calendar&action=index&view=".$cal['view']."".$cal['calendar']->date_time->get_date_str()."&parenttab=".$category."'><b>".display_date($cal['view'],$cal['calendar']->date_time)."</b></a> ".get_next_its_cal($cal)."</td>"; $minical .= "<td class='calHdr' align='right'><a href='javascript:ghide(\"miniCal\");'><img src='" . vtiger_imageurl('close.gif', $theme) . "' align='right' border='0'></a>\n\t\t\t\t</td></tr>"; $minical .= "<tr class='hdrNameBg'>"; //To display days in week $minical .= '<th width="12%">' . $mod_strings['LBL_WEEK'] . '</th>'; for ($i = 0; $i < 7; $i++) { $weekday = $mod_strings['cal_weekdays_short'][$i]; $minical .= '<th width="12%">' . $weekday . '</th>'; } $minical .= "</tr>"; $event_class = ''; $class = ''; for ($i = 0; $i < $rows; $i++) { $minical .= "<tr>"; //calculate blank days for first week for ($j = 0; $j < 7; $j++) { $cal['slice'] = $cal['calendar']->month_array[$cal['calendar']->slices[$count]]; $class = dateCheck($cal['slice']->start_time->get_formatted_date()); if ($j == 0) { $minical .= "<td style='text-align:center' ><a href='javascript:changeCalendarWeekDate(" . $cal['slice']->start_time->year . "," . $cal['slice']->start_time->month . "," . $cal['slice']->start_time->day . ");'>" . $cal['slice']->start_time->week . "</td>"; //index.php?module=Calendar&action=index&view=week".$cal['slice']->start_time->get_date_str()."&parenttab=".$category } //To differentiate day having events from other days if (count($cal['slice']->activities) != 0 && $cal['slice']->start_time->get_formatted_date() == $cal['slice']->activities[0]->start_time->get_formatted_date()) { $event_class = 'class="eventDay"'; } else { $event_class = ''; } //To differentiate current day from other days if ($class != '') { $class = 'class="' . $class . '"'; } else { $class = $event_class; } //To display month dates if ($cal['slice']->start_time->getMonth() == $cal['calendar']->date_time->getMonth()) { $minical .= "<td " . $class . " style='text-align:center' >"; $minical .= "<a href='javascript:changeCalendarDayDate(" . $cal['slice']->start_time->year . "," . $cal['slice']->start_time->month . "," . $cal['slice']->start_time->day . ");'>"; //$minical .= "<a href='index.php?module=Calendar&action=index&view=".$cal['slice']->getView()."".$cal['slice']->start_time->get_date_str()."&parenttab=".$category."'>BBBBBB"; $minical .= $cal['slice']->start_time->get_Date() . "</a></td>"; } else { $minical .= "<td style='text-align:center' ></td>"; } $count++; } $minical .= '</tr>'; } $minical .= "</table>"; echo $minical; }
?> "> <div class="panel-heading"> <h3 class="panel-title"><?php echo display_date('d/m/Y', $t->start); ?> | <?php echo h($t->user_name); ?> </h3> </div> <div class="panel-body"> <span class="pull-right"> Start — End | Time<br> <?php echo display_date('H:i', $t->start) . '—' . display_date('H:i', $t->end); ?> | <?php echo round(($t->end - $t->start) / 60 / 60, 1); ?> h </span> <?php echo h($t->description); ?> </div> </div> <?php } ?>
?> <table> <tbody> <tr> <th>Page viewed</th> <th>Query string</th> <th>Time of view</th> </tr> <?php do { if ($row["ip_total"] > 1) { $ip_list = "More than 1"; } else { $ip_list = $row["ip_address_list"]; } $time = display_date(strtotime($row["timestamp"])); echo "<tr>"; echo "<td>{$row["page_name"]}</td>"; echo "<td>{$row["query_string"]}</td>"; echo "<td>{$time}</td>"; echo "</tr>"; } while ($row = mysql_fetch_array($result)); ?> </tbody> </table> <?php } else { ?> <h3>No records for this visitor</h3> <?php }
<div class="img-container"> <img src="<?php echo $attachment_src; ?> " alt="<?php echo $attachment_alt; ?> "/> </div> <?php } ?> <div class="text-container"> <p class="date"> <?php display_date(); ?> </p> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <h3 class="news-title"> <?php the_title(); ?> </h3> </a>
echo "<td>Complete</td>"; } else { if ($t['Department_ID']) { $department = $slave->select("SELECT Department_Name FROM Departments WHERE Department_ID=" . $t['Department_ID']); $assigned = $department[0]['Department_Name']; } elseif ($t['Assigned_User_ID']) { $user = $slave->select("SELECT First_Name, Last_Name FROM Users WHERE User_ID=" . $t['Assigned_User_ID']); $assigned = display_name($user[0]['First_Name'], $user[0]['Last_Name']); } echo "<td>{$assigned}</td>\n"; } echo "<td>" . display_name($t['Log_First'], $t['Log_Last']) . "</td>\n"; if ($t['Log_Date']) { $finish_date = display_date($t['Log_Date']); } else { $finish_date = display_date($t['Creation_Date']); } echo "<td>" . $finish_date . "</td>\n"; echo "<td>"; echo "<input type=\"hidden\" name=\"progress[" . $t['Task_ID'] . "]\" value=\"" . $t['Progress'] . "\" />"; echo "<input type=\"submit\" name=\"acknowledge[" . $t['Task_ID'] . "]\" value=\"Acknowledge\"></td></tr>\n"; //if ($note) { echo "<tr><td colspan=9>"; //echo "<div id=\"note_".$t['Task_ID']."\" style=\"display:none\">"; if ($t['Log_ID']) { echo $t['Public_Note']; if ($_SESSION['manager'] and $t['Log_Note']) { echo "<br /><i><strong>Private:</strong> " . $t['Log_Note'] . "</i>\n"; } } else { echo $t['Task_Description'];
<div class="panel panel-<?php echo !$t->end ? 'danger' : 'info'; ?> "> <div class="panel-heading"> <h3 class="panel-title"> <span class="pull-right"><?php echo display_date('H:i', $t->start) . ' – ' . display_date('H:i', $t->end); ?> (<?php echo round(($t->end - $t->start) / 60 / 60, 1); ?> h)</span> <?php echo display_date('d/m', $t->start); ?> | <?php echo h($t->client_name . ' – ' . $t->project_name); ?> by <?php echo h($t->user_name); ?> <?php if ($this->uri->segment(4) > 0) { $filtered[] = round(($t->end - $t->start) / 60 / 60, 1); } ?> </h3> </div>
<div class="img-container"> <img src="<?php echo $attachment_src; ?> " alt="<?php echo $attachment_alt; ?> "/> </div> <?php } ?> <div class="text-container"> <p class="date"> <?php display_date($news); ?> </p> <h3 class="news-title"> <?php echo $news->post_title; ?> </h3> <p class="news-description"> <?php echo wp_trim_words($news->post_content, 50); ?> </p> </div> <a class="link-section" href="<?php echo get_the_permalink($news);
} else { echo ""; } if ($_GET['occurs'] > 0) { echo '<fieldset><legend>Range</legend> <table><tr> <td>Starts:</td> <td><input type="text" name="start_range" value="'; if ($start_range) { echo display_date($start_range); } else { echo date('m/d/Y'); } echo '" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)" /></td> <td><input type="radio" name="ends" value="0"'; if (!$end_range) { echo ' checked="checked"'; } echo ' />No end date<br /> <input type="radio" name="ends" value="1"'; if ($end_range) { echo ' checked="checked"'; } echo ' />Ends: <input type="text" name="end_range"'; if ($end_range) { echo " value=\"" . display_date($end_range) . "\""; } echo ' onfocus="this.select();lcs(this);document.getElementsByName(\'ends\')[1].checked=true;" onclick="event.cancelBubble=true;this.select();lcs(this);" /></td> </tr></table> </fieldset>'; }