public function deploy($element, $flag, $alias = '', $view = '', $schema = '') { $h = new Html(); if ($flag == 0) { $attr = '{"id":"' . $alias . '-' . $view . '"}'; $h->b($element, 0, 1, $schema, $attr); } else { $h->b($element, 1, 1); } }
/** * @hook example_add_row_action(array(<ExampleData> 'data', <String> 'actions') * @param Web $w */ function index_ALL(Web $w) { // adding data to the template context $w->ctx("message", "Example Data List"); // get the list of data objects $listdata = $w->Example->getAllData(); // prepare table data $t[] = array("Title", "Data", "Actions"); // table header if (!empty($listdata)) { foreach ($listdata as $d) { $row = array(); $row[] = $d->title; $row[] = $d->data; // prepare action buttons for each row $actions = array(); if ($d->canEdit($w->Auth->user())) { $actions[] = Html::box("/example/edit/" . $d->id, "Edit", true); } if ($d->canDelete($w->Auth->user())) { $actions[] = Html::b("/example/delete/" . $d->id, "Delete", "Really delete?"); } // allow any other module to add actions here $actions = $w->callHook("example", "add_row_action", array("data" => $d, "actions" => $actions)); $row[] = implode(" ", $actions); $t[] = $row; } } // create the html table and put into template context $w->ctx("table", Html::table($t, "table", "tablesorter", true)); }
/** * Display a list of all groups which are not deleted * * @param <type> $w */ function groups_GET(Web &$w) { $w->Admin->navigation($w, "Groups"); $table = array(array("Title", "Parent Groups", "Operations")); $groups = $w->Auth->getGroups(); if ($groups) { foreach ($groups as $group) { $ancestors = array(); $line = array(); $line[] = $w->Auth->user()->is_admin ? Html::box($w->localUrl("/admin/groupedit/" . $group->id), "<u>" . $group->login . "</u>") : $group->login; //if it is a sub group from other group; $groupUsers = $group->isInGroups(); if ($groupUsers) { foreach ($groupUsers as $groupUser) { $ancestors[] = $groupUser->getGroup()->login; } } $line[] = count($ancestors) > 0 ? "<div style=\"color:green;\">" . implode(", ", $ancestors) . "</div>" : ""; $operations = Html::b("/admin/moreInfo/" . $group->id, "More Info"); if ($w->Auth->user()->is_admin) { $operations .= Html::b("/admin/groupdelete/" . $group->id, "Delete", "Are you sure you want to delete this group?"); } $line[] = $operations; $table[] = $line; } } if ($w->Auth->user()->is_admin) { $w->out(Html::box("/admin/groupadd", "New Group", true)); } $w->out(Html::table($table, null, "tablesorter", true)); }
function lookup_ALL(Web &$w) { $w->Admin->navigation($w, "Lookup"); $types = $w->Admin->getLookupTypes(); $typelist = Html::select("type", $types, $w->request('type')); $w->ctx("typelist", $typelist); // tab: Lookup List $where = array(); if (NULL == $w->request('reset')) { if ($w->request('type') != "") { $where['type'] = $w->request('type'); } } else { // Reset called, unset vars if ($w->request("type") !== null) { unset($_REQUEST["type"]); } var_dump($_REQUEST); } $lookup = $w->Admin->getAllLookup($where); $line[] = array("Type", "Code", "Title", "Actions"); if ($lookup) { foreach ($lookup as $look) { $line[] = array($look->type, $look->code, $look->title, Html::box($w->localUrl("/admin/editlookup/" . $look->id . "/" . urlencode($w->request('type'))), " Edit ", true) . " " . Html::b($w->webroot() . "/admin/deletelookup/" . $look->id . "/" . urlencode($w->request('type')), " Delete ", "Are you sure you wish to DELETE this Lookup item?")); } } else { $line[] = array("No Lookup items to list", null, null, null); } // display list of items, if any $w->ctx("listitem", Html::table($line, null, "tablesorter", true)); // tab: new lookup item $types = $w->Admin->getLookupTypes(); $f = Html::form(array(array("Create a New Entry", "section"), array("Type", "select", "type", null, $types), array("or Add New Type", "text", "ntype"), array("Key", "text", "code"), array("Value", "text", "title")), $w->localUrl("/admin/newlookup/"), "POST", " Save "); $w->ctx("newitem", $f); }
function printqueue_GET(Web $w) { $print_folder = FILE_ROOT . "print"; $path = realpath($print_folder); // Check if folder exists if ($path === false) { // Make print folder (If you specify a full path, use the recursion flag because it seems to crash without it in unix) // Other wise you would need to chdir to the parent folder, create and change back to wherever execution currently was at mkdir($print_folder, 0777, true); $path = realpath($print_folder); } $exclude = array("THUMBS.db"); $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $table_data = array(); $table_header = array("Name", "Size", "Date Created", "Actions"); foreach ($objects as $name => $object) { $filename = $object->getFilename(); // Ignore files starting with '.' and in exclude array if ($filename[0] === '.' || in_array($filename, $exclude)) { continue; } $table_data[] = array(Html::a("/uploads/print/" . $filename, $filename), humanReadableBytes($object->getSize()), date("H:i d/m/Y", filectime($name)), Html::box("/admin/printfile?filename=" . urlencode($name), "Print", true) . " " . Html::b("/admin/deleteprintfile?filename=" . urlencode($name), "Delete", "Are you sure you want to remove this file? (This is irreversible)")); } $w->out(Html::table($table_data, null, "tablesorter", $table_header)); }
/** * This is an example of a hook that adds things to a screen. * Look at /example/actions/index.php where this is called. * * @param Web $w * @param array $actions * @return array the passed in array of actions plus any additional actions */ function example_example_add_row_action(Web $w, $params) { $data = $params['data']; $actions = $params['actions']; $actions[] = Html::b("", "HOOK for id #" . $data->id); return $actions; }
/** * Display member and permission infomation * * @param <type> $w */ function moreInfo_GET(Web &$w) { $option = $w->pathMatch("group_id"); $w->Admin->navigation($w, $w->Auth->getUser($option['group_id'])->login); if ($w->Auth->user()->is_admin || $w->Auth->getRoleForLoginUser($option['group_id'], $w->Auth->user()->id) == "owner") { $w->ctx("addMember", Html::box("/admin/groupmember/" . $option['group_id'], "New Member", true)); } $w->ctx("editPermission", Html::b("/admin/permissionedit/" . $option['group_id'], "Edit Permissions")); //fill in member table; $table = array(array("Name", "Role", "Operations")); $groupMembers = $w->Auth->getGroupMembers($option['group_id']); if ($groupMembers) { foreach ($groupMembers as $groupMember) { $line = array(); $style = $groupMember->role == "owner" ? "<div style=\"color:red;\">" : "<div style=\"color:blue;\">"; $name = $groupMember->getUser()->is_group == 1 ? $groupMember->getUser()->login : $groupMember->getUser()->getContact()->getFullName(); $line[] = $style . $name . "</div>"; $line[] = $style . $groupMember->role . "</div>"; if ($w->Auth->user()->is_admin || $w->Auth->getRoleForLoginUser($option['group_id'], $w->Auth->user()->id) == "owner") { $line[] = Html::a("/admin/memberdelete/" . $option['group_id'] . "/" . $groupMember->id, "Delete", null, null, "Are you sure you want to delete this member?"); } else { $line[] = null; } $table[] = $line; } } $w->ctx("memberList", Html::table($table, null, "tablesorter", true)); }
function index_ALL(Web $w) { $connections = $w->Report->getConnections(); $table_header = array("Driver", "Host", "Database", "Port", "Username", "Actions"); $table_body = array(); if (!empty($connections)) { foreach ($connections as $conn) { $conn->decrypt(); $table_body[] = array($conn->db_driver, $conn->db_host, $conn->db_database, $conn->db_port, $conn->s_db_user, Html::box("/report-connections/test/{$conn->id}", "Test Connection", true) . Html::box("/report-connections/edit/{$conn->id}", "Edit", true) . Html::b("/report-connections/delete/{$conn->id}", "Delete", "Are you sure you want to remove this connection?")); } } $w->ctx("connections_table", Html::table($table_body, null, "tablesorter", $table_header)); }
function index_GET($w) { $w->Admin->navigation($w, "Templates"); $templates = $w->Template->findTemplates(); $table_header = array("Title", "Module", "Category", array("Active?", true), array("Created", true), array("Modified", true), "Actions"); $table_data = array(); if (!empty($templates)) { foreach ($templates as $t) { $table_data[] = array($t->title, $t->module, $t->category, array($t->is_active ? "Active" : "Inactive", true), array(Date("H:i d-m-Y", $t->dt_created), true), array(Date("H:i d-m-Y", $t->dt_modified), true), Html::b("/admin-templates/edit/" . $t->id, "Edit", false)); } } $w->ctx("templates_table", Html::table($table_data, null, "tablesorter", $table_header)); }
function printers_GET(Web $w) { $printers = $w->Printer->getPrinters(); $table_data = array(); $table_header = array("Name", "Server", "Port", "Actions"); if (!empty($printers)) { foreach ($printers as $printer) { $table_data[] = array($printer->name, $printer->server, $printer->port, Html::box("/admin/editprinter/{$printer->id}", "Edit", true) . Html::b("/admin/deleteprinter/{$printer->id}", "Delete", "Are you sure you want to delete this printer?")); } } $w->ctx("table_header", $table_header); $w->ctx("table_data", $table_data); }
function users_GET(Web &$w) { $w->Admin->navigation($w, "Users"); $header = array("Login", "First Name", "Last Name", array("Admin", true), array("Active", true), array("Created", true), array("Last Login", true), "Operations"); // $result = $w->db->sql("select user.id as id,login,firstname,lastname,is_admin,is_active,user.dt_created as dt_created,dt_lastlogin from user left join contact on user.contact_id = contact.id where user.is_deleted = 0 AND user.is_group = 0")->fetch_all(); // $result = $w->db->get("user")->select("user.*, contact.*")->leftJoin("contact on user.contact_id = contact.id")->where("user.is_deleted", 0)->where("user.is_group", 0)->fetch_all(); $users = $w->Admin->getObjects("User", array("is_deleted" => 0, "is_group" => 0)); $data = array(); foreach ($users as $user) { $contact = $user->getContact(); $firstName = ''; $lastName = ''; if (!empty($contact)) { $firstName = $contact->firstname; $lastName = $contact->lastname; } $data[] = array($user->login, $firstName, $lastName, array($user->is_admin ? "X" : "", true), array($user->is_active ? "X" : "", true), array($w->Admin->time2Dt($user->dt_created), true), array($w->Admin->time2Dt($user->dt_lastlogin), true), Html::box($w->localUrl("/admin/useredit/" . $user->id . "/box"), "Edit", true) . Html::b("/admin/permissionedit/" . $user->id, "Permissions") . Html::b($w->localUrl("/admin/userdel/" . $user->id), "Delete", "Are you sure to delete this user?")); } $w->ctx("table", Html::table($data, null, "tablesorter", $header)); }
function runreport_ALL(Web &$w) { $w->Report->navigation($w, "Generate Report"); $p = $w->pathMatch("id"); // if there is a report ID in the URL ... if (!empty($p['id'])) { // get member $member = $w->Report->getReportMember($p['id'], $w->session('user_id')); // get the relevant report $rep = $w->Report->getReportInfo($p['id']); // if report exists, first check status and user role before displaying if (!empty($rep)) { if ($rep->is_approved == "0" && $member->role != "EDITOR" && !$w->Auth->user()->hasRole("report_admin")) { $w->msg($rep->title . ": Report is yet to be approved", "/report/index/"); } else { // display form $w->Report->navigation($w, $rep->title); if (!empty($member->role) && $member->role == "EDITOR" || $w->Auth->hasRole("report_admin")) { $btnedit = Html::b("/report/viewreport/" . $rep->id, " Edit Report "); } else { $btnedit = ""; } // get the form array $form = $rep->getReportCriteria(); // if there is a form display it, otherwise say as much if ($form) { $theform = Html::form($form, $w->localUrl("/report/exereport/" . $rep->id), "POST", " Display Report "); } else { $theform = "No search criteria?"; } // display $w->ctx("btnedit", $btnedit); $w->ctx("report", $theform); } } } }
function listfeed_ALL(Web &$w) { $w->Report->navigation($w, "Feeds"); // get all feeds $feeds = $w->Report->getFeeds(); // prepare table headings $line = array(array("Feed", "Report", "Description", "Created", "")); // if feeds exists and i am suitably authorised, list them if ($feeds && ($w->Auth->user()->hasRole("report_editor") || $w->Auth->user()->hasRole("report_admin"))) { foreach ($feeds as $feed) { // get report data $rep = $w->Report->getReportInfo($feed->report_id); // display the details if ($rep) { $line[] = array($feed->title, $rep->title, $feed->description, formatDateTime($feed->dt_created), Html::b(WEBROOT . "/report/editfeed/" . $feed->id, " View ") . Html::b(WEBROOT . "/report/deletefeed/" . $feed->id, " Delete ", "Are you sure you wish to DELETE this feed?")); } } } else { // no feeds and/or no access $line[] = array("No feeds to list", "", "", "", ""); } // display results $w->ctx("feedlist", Html::table($line, null, "tablesorter", true)); }
function edit_GET($w) { $p = $w->pathMatch("id"); $task = !empty($p["id"]) ? $w->Task->getTask($p["id"]) : new Task($w); if (!empty($task->id) && !$task->canView($w->Auth->user())) { $w->error("You do not have permission to edit this Task", "/task/tasklist"); } // Get a list of the taskgroups and filter by what can be used $taskgroups = array_filter($w->Task->getTaskGroups(), function ($taskgroup) { return $taskgroup->getCanICreate(); }); $tasktypes = array(); $priority = array(); $members = array(); // Try and prefetch the taskgroup by given id $taskgroup = null; $taskgroup_id = $w->request("gid"); if (!empty($taskgroup_id) || !empty($task->task_group_id)) { $taskgroup = $w->Task->getTaskGroup(!empty($task->task_group_id) ? $task->task_group_id : $taskgroup_id); if (!empty($taskgroup->id)) { $tasktypes = $w->Task->getTaskTypes($taskgroup->task_group_type); $priority = $w->Task->getTaskPriority($taskgroup->task_group_type); $members = $w->Task->getMembersBeAssigned($taskgroup->id); sort($members); } } // Create form $form = array(!empty($p["id"]) ? "Edit task" : "Create a new task" => array(array(!empty($p["id"]) ? array("Task Group", "text", "-task_group_id_text", $taskgroup->title) : array("Task Group", "autocomplete", "task_group_id", !empty($task->task_group_id) ? $task->task_group_id : $taskgroup_id, $taskgroups), !empty($p["id"]) ? array("Task Type", "select", "-task_type", $task->task_type, $tasktypes) : array("Task Type", "select", "task_type", $task->task_type, $tasktypes)), array(array("Task Title", "text", "title", $task->title), array("Status", "select", "status", $task->status, $task->getTaskGroupStatus())), array(array("Priority", "select", "priority", $task->priority, $priority), array("Date Due", "date", "dt_due", formatDate($task->dt_due)), !empty($taskgroup) && $taskgroup->getCanIAssign() ? array("Assigned To", "select", "assignee_id", $task->assignee_id, $members) : array("Assigned To", "select", "-assignee_id", $task->assignee_id, $members)), array(array("Description", "textarea", "description", $task->description)))); if (empty($p['id'])) { History::add("New Task"); } else { History::add("Task: {$task->title}"); } $w->ctx("task", $task); $w->ctx("form", Html::multiColForm($form, $w->localUrl("/task/edit/{$task->id}"), "POST", "Save", "edit_form")); ////////////////////////// // Build time log table // ////////////////////////// $timelog = $task->getTimeLog(); $total_seconds = 0; $table_header = array("Assignee", "Start", "Period (hours)", "Comment", "Actions"); $table_data = array(); if (!empty($timelog)) { // for each entry display, calculate period and display total time on task foreach ($timelog as $log) { // get time difference, start to end $seconds = $log->dt_end - $log->dt_start; $period = $w->Task->getFormatPeriod($seconds); $comment = $w->Comment->getComment($log->comment_id); $comment = !empty($comment) ? $comment->comment : ""; $table_row = array($w->Task->getUserById($log->user_id), formatDateTime($log->dt_start), $period, !empty($comment) ? $w->Comment->renderComment($comment) : ""); // Build list of buttons $buttons = ''; if ($log->is_suspect == "0") { $total_seconds += $seconds; $buttons .= Html::box($w->localUrl("/task/addtime/" . $task->id . "/" . $log->id), " Edit ", true); } if ($w->Task->getIsOwner($task->task_group_id, $w->Auth->user()->id)) { $buttons .= Html::b($w->localUrl("/task/suspecttime/" . $task->id . "/" . $log->id), empty($log->is_suspect) || $log->is_suspect == "0" ? "Review" : "Accept"); } $buttons .= Html::b($w->localUrl("/task/deletetime/" . $task->id . "/" . $log->id), "Delete", "Are you sure you wish to DELETE this Time Log Entry?"); $table_row[] = $buttons; $table_data[] = $table_row; } $table_data[] = array("<b>Total</b>", "", "<b>" . $w->Task->getFormatPeriod($total_seconds) . "</b>", "", ""); } // display the task time log $w->ctx("timelog", Html::table($table_data, null, "tablesorter", $table_header)); /////////////////// // Notifications // /////////////////// $notify = null; // If I am assignee, creator or task group owner, I can get notifications for this task if (!empty($task->id) && $task->getCanINotify()) { // get User set notifications for this Task $notify = $w->Task->getTaskUserNotify($w->Auth->user()->id, $task->id); if (empty($notify)) { $logged_in_user_id = $w->Auth->user()->id; // Get my role in this task group $me = $w->Task->getMemberGroupById($task->task_group_id, $logged_in_user_id); $type = ""; if ($task->assignee_id == $logged_in_user_id) { $type = "assignee"; } else { if ($task->getTaskCreatorId() == $logged_in_user_id) { $type = "creator"; } else { if ($w->Task->getIsOwner($task->task_group_id, $logged_in_user_id)) { $type = "other"; } } } if (!empty($type) && !empty($me)) { $notify = $w->Task->getTaskGroupUserNotifyType($logged_in_user_id, $task->task_group_id, strtolower($me->role), $type); } } // create form. if still no 'notify' all boxes are unchecked $form = array("Notification Events" => array(array(array("", "hidden", "task_creation", "0")), array(array("Task Details Update", "checkbox", "task_details", !empty($notify->task_details) ? $notify->task_details : null), array("Comments Added", "checkbox", "task_comments", !empty($notify->task_comments) ? $notify->task_comments : null)), array(array("Time Log Entry", "checkbox", "time_log", !empty($notify->time_log) ? $notify->time_log : null), array("Task Data Updated", "checkbox", "task_data", !empty($notify->task_data) ? $notify->task_data : null)), array(array("Documents Added", "checkbox", "task_documents", !empty($notify->task_documents) ? $notify->task_documents : null)))); $w->ctx("tasknotify", Html::multiColForm($form, $w->localUrl("/task/updateusertasknotify/" . $task->id), "POST")); } }
<td><?php echo $household->is_occupied ? "yes" : ""; ?> </td> <td> <?php $occupants = $household->getCurrentOccupants(); if (!empty($occupants)) { foreach ($occupants as $oc) { echo $oc->getFullname() . ", "; } } ?> </td> <td> <?php echo Html::b("/bend-household/show/" . $household->getLot()->id . '/' . $household->id, "Details"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } ?>
<?php } ?> </div> <div class="tab-body"> <div id="details" class="clearfix"> <div class="row-fluid clearfix"> <div class="row-fluid columns"> <?php echo $w->Favorite->getFavoriteButton($task->id, "Task") . " "; // Note the extra buttons only show when the task_type object $tasktypeobject = $task->getTaskTypeObject(); echo !empty($tasktypeobject) ? $tasktypeobject->displayExtraButtons($task) : null; ?> <?php echo !empty($task->id) && $task->canDelete($w->Auth->user()) ? Html::b($task->w->localUrl('/task/delete/' . $task->id), "Delete", "Are you sure you want to delete this task?") : ''; ?> </div> <div class="row-fluid clearfix"> <div class="small-12 large-9"> <?php echo $form; ?> </div> <div class="small-12 large-3 right"> <div class="small-12 panel" id="tasktext" style="display: none;"></div> <div class="small-12 panel clearfix" id="formfields" style="display: none;"></div> <div class="small-12 panel clearfix" id="formdetails" style="display: none;"></div> </div> </div> </div>
function viewtask_GET(Web &$w) { $p = $w->pathMatch("id"); // declare delete button $btndelete = ""; // get relevant object for viewing a task given input task ID $task = $w->Task->getTask($p['id']); $w->ctx("task", $task); $taskdata = $w->Task->getTaskData($p['id']); $group = $w->Task->getTaskGroup($task->task_group_id); $w->Task->navigation($w, "View Task: " . $task->title); // if task is deleted, say as much and return to task list if ($task->is_deleted != 0) { $w->msg("This Task has been deleted", "/task/tasklist/"); } elseif ($task->getCanIView()) { History::add("Task: {$task->title}"); // tab: Task Details // if I can assign tasks, provide dropdown of group members else display current assignee. // my role in group Vs group can_assign value if ($task->getCanIAssign()) { $members = $task ? $w->Task->getMembersBeAssigned($task->task_group_id) : $w->Auth->getUsers(); sort($members); $assign = array("Assigned To", "select", "assignee_id", $task->assignee_id, $members); } else { $assigned = $task->assignee_id == "0" ? "Not Assigned" : $w->Task->getUserById($task->assignee_id); $assign = array("Assigned To", "static", "assignee_id", $assigned); } // changing type = dymanically loading of relevant form fields ... problem when presenting on single page. // array("Task Type","select","task_type",$task->task_type,$task->getTaskGroupTypes()), // check a due date exists $dtdue = $task->dt_due == "0000-00-00 00:00:00" || $task->dt_due == "" ? "" : date('d/m/Y', $task->dt_due); // Guests can view but not edit // See if i am assignee or creator, if yes provide editable form, else provide static display $btndelete = ""; if ($task->getCanIEdit()) { $btndelete = Html::b(WEBROOT . "/task/deletetask/" . $task->id, " Delete Task ", "Are you should you with to DELETE this task?"); // if task is closed and Task Group type says cannot be reopened, display static status if ($task->getisTaskClosed() && !$task->getTaskReopen()) { $status = array("Status", "static", "status", $task->status); } else { $status = array("Status", "select", "status", $task->status, $task->getTaskGroupStatus()); } $f = array(array("Task Details", "section"), array("Title", "text", "title", $task->title), array("Created By", "static", "creator", $task->getTaskCreatorName()), array("Task Group", "static", "tg", $task->getTaskGroupTypeTitle()), array("Task Type", "static", "task_type", $task->getTypeTitle()), array("Description", "static", "tdesc", $task->getTypeDescription()), $status, array("Priority", "select", "priority", $task->priority, $task->getTaskGroupPriority()), array("Date Due", "date", "dt_due", $dtdue), array("Description", "textarea", "description", $task->description, "80", "15"), $assign); } else { $f = array(array("Task Details", "section"), array("Title", "static", "title", $task->title), array("Created By", "static", "creator", $task->getTaskCreatorName()), array("Task Group", "static", "tg", $task->getTaskGroupTypeTitle()), array("Task Type", "static", "task_type", $task->getTypeTitle()), array("Description", "static", "tdesc", $task->getTypeDescription()), array("Status", "static", "status", $task->status), array("Priority", "static", "priority", $task->priority), array("Date Due", "static", "dt_due", $dtdue), array("Description", "static", "description", str_replace("\r\n", "<br>", $task->description)), $assign); } // got additional form fields for this task type $form = $w->Task->getFormFieldsByTask($task->task_type, $group); // if there are additional form fields, display them if ($form) { // string match form fields with task data by key // can then push db:value into form field for display foreach ($form as $x) { if ($x[1] == "section") { array_push($f, $x); } if ($taskdata) { foreach ($taskdata as $td) { $key = $td->key; $value = $td->value; // Guests can view but not edit // See if i am a guest, if yes provide static display, else provide editable form if (!$task->getCanIEdit()) { $x[1] = "static"; } if ($key == $x[2]) { $x[3] = $value; array_push($f, $x); } } } else { if ($x[1] != "section") { array_push($f, $x); } } } } // create form $form = Html::form($f, $w->localUrl("/task/updatetask/" . $task->id), "POST", " Update "); // create 'start time log' button $buttontimelog = ""; if ($task->assignee_id == $w->Auth->user()->id) { $buttontimelog = new \Html\Button(); $buttontimelog->href("/task/starttimelog/{$task->id}")->setClass("startTime button small")->text("Start Time Log"); // $btntimelog = "<button class=\"startTime\" href=\"/task/starttimelog/".$task->id."\"> Start Time Log </button>"; } // display variables $w->ctx("btntimelog", !empty($buttontimelog) ? $buttontimelog->__toString() : ""); $w->ctx("btndelete", $btndelete); $w->ctx("viewtask", $form); $w->ctx("extradetails", $task->displayExtraDetails()); // tab: time log // provide button to add time entry $addtime = ""; if ($task->assignee_id == $w->Auth->user()->id) { $addtime = Html::box(WEBROOT . "/task/addtime/" . $task->id, " Add Time Log entry ", true); } $w->ctx("addtime", $addtime); // get time log for task $timelog = $task->getTimeLog(); // set total period $totseconds = 0; // set headings $line = array(array("Assignee", "Start", "End", "Period (hours)", "Comment", "")); // if log exists, display ... if ($timelog) { // for each entry display, calculate period and display total time on task foreach ($timelog as $log) { // get time difference, start to end $seconds = $log->dt_end - $log->dt_start; $period = $w->Task->getFormatPeriod($seconds); // if suspect, label button, style period, remove edit button if ($log->is_suspect == "1") { $label = " Accept "; $period = "(" . $period . ")"; $bedit = ""; } // if accepted, label button, tally period, include edit button if ($log->is_suspect == "0") { $label = " Review "; $totseconds += $seconds; $bedit = Html::box($w->localUrl("/task/addtime/" . $task->id . "/" . $log->id), " Edit ", true); } // ony Task Group owner gets to reject/accept time log entries $bsuspect = $w->Task->getIsOwner($task->task_group_id, $_SESSION['user_id']) ? Html::b($w->localUrl("/task/suspecttime/" . $task->id . "/" . $log->id), $label) : ""; $line[] = array($w->Task->getUserById($log->user_id), $w->Task->getUserById($log->creator_id), formatDateTime($log->dt_start), formatDateTime($log->dt_end), $period, !empty($w->Comment->getComment($log->comment_id)) ? $w->Comment->getComment($log->comment_id)->comment : "", $bedit . Html::b($w->localUrl("/task/deletetime/" . $task->id . "/" . $log->id), " Delete ", "Are you sure you wish to DELETE this Time Log Entry?") . $bsuspect . Html::box($w->localUrl("/task/popComment/" . $task->id . "/" . $log->comment_id), " Comment ", true)); } $line[] = array("", "", "", "<b>Total</b>", "<b>" . $w->Task->getFormatPeriod($totseconds) . "</b>", ""); } else { $line[] = array("No time log entries have been made", "", "", "", "", ""); } // display the task time log $w->ctx("timelog", Html::table($line, null, "tablesorter", true)); // tab: notifications // if i am assignee, creator or task group owner, i can get notifications for this task if ($task->getCanINotify()) { // get User set notifications for this Task $notify = $w->Task->getTaskUserNotify($_SESSION['user_id'], $task->id); if ($notify) { $task_creation = $notify->task_creation; $task_details = $notify->task_details; $task_comments = $notify->task_comments; $time_log = $notify->time_log; $task_documents = $notify->task_documents; } else { // need my role in group $me = $w->Task->getMemberGroupById($task->task_group_id, $_SESSION['user_id']); // get task creator ID $creator_id = $task->getTaskCreatorId(); // which am i? $assignee = $task->assignee_id == $_SESSION['user_id'] ? true : false; $creator = $creator_id == $_SESSION['user_id'] ? true : false; $owner = $w->Task->getIsOwner($task->task_group_id, $_SESSION['user_id']); // get single type given this is specific to a single Task if ($assignee) { $type = "assignee"; } elseif ($creator) { $type = "creator"; } elseif ($owner) { $type = "other"; } $role = strtolower($me->role); if ($type) { // for type, check the User defined notification table $notify = $w->Task->getTaskGroupUserNotifyType($_SESSION['user_id'], $task->task_group_id, $role, $type); // get list of notification flags if ($notify) { if ($notify->value == "1") { $task_creation = $notify->task_creation; $task_details = $notify->task_details; $task_comments = $notify->task_comments; $time_log = $notify->time_log; $task_documents = $notify->task_documents; $task_pages = $notify->task_pages; } } } } // create form. if still no 'notify' all boxes are unchecked $f = array(array("For which Task Events should you receive Notification?", "section")); $f[] = array("", "hidden", "task_creation", "0"); $f[] = array("Task Details Update", "checkbox", "task_details", !empty($task_details) ? $task_details : null); $f[] = array("Comments Added", "checkbox", "task_comments", !empty($task_comments) ? $task_comments : null); $f[] = array("Time Log Entry", "checkbox", "time_log", !empty($time_log) ? $time_log : null); $f[] = array("Task Data Updated", "checkbox", "task_data", !empty($task_data) ? $task_data : null); $f[] = array("Documents Added", "checkbox", "task_documents", !empty($task_documents) ? $task_documents : null); $form = Html::form($f, $w->localUrl("/task/updateusertasknotify/" . $task->id), "POST", "Save"); // display $w->ctx("tasknotify", $form); } } else { // if i cannot view task details, return to task list with error message // for display get my role in the group, the group owners, the group title and the minimum membership required to view a task $me = $w->Task->getMemberGroupById($task->task_group_id, $_SESSION['user_id']); $myrole = !$me ? "Not a Member" : $me->role; $owners = $w->Task->getTaskGroupOwners($task->task_group_id); // get owners names for display $strOwners = ""; foreach ($owners as $owner) { $strOwners .= $w->Task->getUserById($owner->user_id) . ", "; } $strOwners = rtrim($strOwners, ", "); $form = "You must be at least a <b>" . $group->can_view . "</b> of the Task Group: <b>" . strtoupper($group->title) . "</b>, to view tasks in this group.<p>Your current Membership Level: <b>" . $myrole . "</b><p>Please appeal to the group owner(s): <b>" . $strOwners . "</b> for promotion."; $w->error($form, "/task/tasklist"); } }
function viewreport_GET(Web &$w) { $w->Report->navigation($w, "Edit Report"); $p = $w->pathMatch("id"); // tab: view report // if there is a report ID in the URL ... if ($p['id']) { // get member $member = $w->Report->getReportMember($p['id'], $w->session('user_id')); // get the relevant report $rep = $w->Report->getReportInfo($p['id']); // if the report exists check status & role before displaying if ($rep) { // if ($w->Auth->user()->hasRole("report_user") && (!$w->Auth->user()->hasRole("report_editor")) && (!$w->Auth->user()->hasRole("report_admin"))) { if ($member->role != "EDITOR" && !$w->Auth->user()->hasRole("report_admin")) { // redirect the unauthorised $w->msg("Sorry, you are not authorised to edit this Report", "/report/index/"); } elseif ($w->Auth->user()->hasRole("report_admin")) { // build the report for edit WITH an Approval checkbox // using lookup with type ReportCategory for category listing // get list of modules $modules = $w->Report->getModules(); $f = Html::form(array(array("Report Definition", "section"), array("Title", "text", "title", $rep->title), array("Module", "select", "module", $rep->module, $modules), array("Description", "textarea", "description", $rep->description, 110, 2, false), array("Code", "textarea", "report_code", $rep->report_code, 110, 22, false), array("Approved", "checkbox", "is_approved", $rep->is_approved), array("Connection", "select", "report_connection_id", $rep->report_connection_id, $w->Report->getConnections())), $w->localUrl("/report/editreport/" . $rep->id), "POST", " Update Report "); // provide a button by which the report may be tested, ie. executed $btntestreport = Html::b("/report/runreport/" . $rep->id, " Test the Report "); $w->ctx("btntestreport", $btntestreport); // create form providing view of tables and fields $t = Html::form(array(array("Special Parameters", "section"), array("User", "static", "user", "{{current_user_id}}"), array("Roles", "static", "roles", "{{roles}}"), array("Site URL", "static", "webroot", "{{webroot}}"), array("View Database", "section"), array("Tables", "select", "dbtables", null, $w->Report->getAllDBTables()), array("Fields", "static", "dbfields", "<span id='dbfields'></span>"))); $w->ctx("dbform", $t); } elseif ($member->role == "EDITOR") { // build the report for edit. edited forms again require approval // using lookup with type ReportCategory for category listing // get list of modules $modules = $w->Report->getModules(); $f = Html::form(array(array("Create a New Report", "section"), array("Title", "text", "title", $rep->title), array("Module", "select", "module", $rep->module, $modules), array("Category", "select", "category", $rep->category, lookupForSelect($w, "ReportCategory")), array("Description", "textarea", "description", $rep->description, 100, 2, true), array("Code", "textarea", "report_code", $rep->report_code, 100, 22, false), array("", "hidden", "is_approved", "0")), $w->localUrl("/report/edit/" . $rep->id), "POST", " Update Report "); // create form providing view of tables and fields $t = Html::form(array(array("Special Parameters", "section"), array("Logged in User", "static", "user", "{{current_user_id}}"), array("User Roles", "static", "roles", "{{roles}}"), array("Site URL", "static", "webroot", "{{webroot}}"), array("View Database", "section"), array("Tables", "select", "dbtables", null, $w->Report->getAllDBTables()), array("Fields", "static", "dbfields", "<span id='dbfields'></span>"))); $w->ctx("dbform", $t); } else { // redirect on all other occassions $w->msg($rep->title . ": Report has yet to be approved", "/report/index/"); } // Get list of templates $report_templates = $rep->getTemplates(); // Build table $table_header = array("Title", "Category", "Type", "Actions"); $table_data = array(); if (!empty($report_templates)) { // Add data to table layout foreach ($report_templates as $report_template) { $template = $report_template->getTemplate(); $table_data[] = array($template->title, $template->category, $report_template->type, Html::box("/report-templates/edit/{$rep->id}/{$report_template->id}", "Edit", true) . Html::b("/report-templates/delete/{$report_template->id}", "Delete", "Are you sure you want to delete this Report template entry?")); } } // Render table $w->ctx("report", $rep); $w->ctx("templates_table", Html::table($table_data, null, "tablesorter", $table_header)); } else { $f = "Report does not exist"; } } else { $f = "Report does not exist"; } // return the form for display and edit $w->ctx("viewreport", $f); $btnrun = Html::b("/report/runreport/" . $rep->id, " Execute Report "); $w->ctx("btnrun", $btnrun); // tab: view members // see report.lib.php ReportLib::viewMemberstab($w, $p['id']); }
<div class="tabs"> <div class="tab-head"> <a href="#members">Members</a> <a href="#notifications">Notifications</a> </div> <div class="tab-body"> <div id="members"> <?php echo Html::b("/task/tasklist/?task_group_id={$groupid}", "Task List"); ?> <?php echo Html::box("/task-group/addgroupmembers/" . $grpid, " Add New Members ", true); ?> <?php echo Html::box($webroot . "/task-group/viewtaskgroup/" . $groupid, " Edit Task Group ", true); ?> <?php echo Html::box($webroot . "/task-group/deletetaskgroup/" . $groupid, " Delete Task Group ", true); ?> <?php echo $viewmembers; ?> </div> <div id="notifications"> <?php echo !empty($notifymatrix) ? $notifymatrix : ""; ?> </div> </div> </div>
} } ?> </td> <td> <?php $households = $lot->getAllHouseholds(); if (!empty($households)) { foreach ($households as $house) { echo $house->streetnumber . ($house->is_chl == 1 ? " (CHL) " : "") . "<br/>"; } } ?> </td> <td> <?php echo Html::b("/bend-lot/showlot/" . $lot->id, "Details"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } ?>
<?php echo Html::b("/admin-templates/edit", "Add Template"); echo !empty($templates_table) ? $templates_table : "";
function exereport_ALL(Web &$w) { $w->Report->navigation($w, "Generate Report"); $p = $w->pathMatch("id"); $arrreq = array(); // prepare export buttons for display if format = html foreach ($_POST as $name => $value) { $arrreq[] = $name . "=" . urlencode($value); } $viewurl = "/report/edit/" . $p['id']; $runurl = "/report/runreport/" . $p['id'] . "/?" . implode("&", $arrreq); $repurl = "/report/exereport/" . $p['id'] . "?"; $strREQ = $arrreq ? implode("&", $arrreq) : ""; $urlcsv = $repurl . $strREQ . "&format=csv"; $btncsv = Html::b($urlcsv, "Export as CSV"); $btnrun = Html::b($runurl, "Edit Report Parameters"); $btnview = Html::b($viewurl, "Edit Report"); $results = ""; // if there is a report ID in the URL ... if (!empty($p['id'])) { // get member $member = $w->Report->getReportMember($p['id'], $w->session('user_id')); // get the relevant report $rep = $w->Report->getReportInfo($p['id']); // if report exists, execute it if (!empty($rep)) { $w->Report->navigation($w, $rep->title); History::add("Run: " . $rep->title); // prepare and execute the report $tbl = $rep->getReportData(); // if we have an empty return, say as much if (!$tbl) { $w->error("No Data found for selections. Please try again....", "/report/runreport/" . $rep->id); } elseif ($tbl[0][0] == "ERROR") { $w->error($tbl[1][0], "/report/runreport/" . $rep->id); } else { // Below ifs will no longer work $request_format = $w->request('format'); // as a cvs file for download if ($request_format == "csv") { $w->setLayout(null); $w->Report->exportcsv($tbl, $rep->title); } elseif ($request_format == "pdf") { $w->setLayout(null); $w->Report->exportpdf($tbl, $rep->title); } elseif ($request_format == "xml") { $w->setLayout(null); $w->Report->exportxml($tbl, $rep->title); } else { // allowing multiple SQL statements, each returns a recordset as a seperate array element, ie. iterate // array: report parameters > report title > data columns > recordset foreach ($tbl as $t) { $crumbs = array_shift($t); $title = array_shift($t); // first row is our column headings $hds[] = array_shift($t); // first row has column names as associative. change keys to numeric to match recordset $tvalues = array_values($hds[0]); // find key of any links foreach ($tvalues as $h) { if (stripos($h, "_link")) { list($fld, $lnk) = preg_split("/_/", $h); $f = array_search($fld . "_link", $tvalues); $ukey[$f] = $fld; unset($hds[0][$h]); } } if (!empty($ukey)) { // now need to find key of fields to link foreach ($tvalues as $m => $h) { foreach ($ukey as $n => $u) { if ($u == $h) { $fkey[$n] = array_search($u, $tvalues); } } } // iterate row to create link and dump URL related fields foreach ($t as $v) { // keys points to fields so need to maintain array and create all URLS // before we start dumping fields and splicing links foreach ($fkey as $n => $u) { $a[$n] = "<a href=\"" . $v[$n] . "\">" . $v[$u] . "</a>"; $dump[] = $n; $dump[] = $u; } // dump url related fields foreach ($dump as $num) { unset($v[$num]); } // add completed URL(s) foreach ($a as $num => $url) { $v[$num] = $url; } // we now have gaps from our unsetting and inserting of links // eg. $v[3], $v[4], $v[6], $v[0] // get array_keys into new array: $sortv = array_keys($v); // sort so keys are now in order dispite the gaps sort($sortv); // create new - ordered - array setting our original array values foreach ($sortv as $num => $val) { $sorted[] = $v[$val]; } $arr[] = $sorted; unset($a); unset($dump); unset($sorted); } // recreate $t $t = $arr; unset($ukey); unset($fkey); } // put headings back into array $t = array_merge($hds, $t); // Render selected template $report_template = $w->Report->getReportTemplate($w->request('format')); $template = null; if (empty($report_template->id)) { // Use default $templates = $w->Template->findTemplates('report', 'default'); $template = $templates[0]; if (empty($template->id)) { $results .= "<b>" . $title . "</b>" . Html::table($t, null, "tablesorter", true); // $w->error("Report template not found", "/report/editreport/{$p['id']}"); } } else { $results .= "<h3 class='subheader'>" . $title . "</h3>" . $w->Template->render(!empty($report_template->template_id) ? $report_template->template_id : $template->id, array("data" => $t, "w" => $w, "POST" => $_POST)); } // build results table // // reset parameters string $strcrumb = ""; unset($hds); unset($arr); } // display export and function buttons $w->ctx("exportcsv", $btncsv); $w->ctx("btnrun", $btnrun); $w->ctx("showreport", $results); // allow editor/admin to edit the report if (!empty($member->role) && $member->role == "EDITOR" || $w->Auth->hasRole("report_admin")) { $w->ctx("btnview", $btnview); } } } } else { // report does not exist? $w->ctx("showreport", "No such report?"); } } }
/** * Same as menuLink but displays a button instead * @param string $path * @param string $title * @param string $array * @return string html code */ function menuButton($path, $title, &$array = null) { $link = $this->Auth->allowed($path, Html::b($this->localUrl($path), $title)); if ($array !== null) { $array[] = $link; } return $link; }
public static function parse($data) { // Replace [b]...[/b] with <strong>...</strong> $matches["/\\[b\\](.*?)\\[\\/b\\]/is"] = function ($match) { return Html::b($match[1]); }; // Replace [sup]...[/sup] with <sup>...</sup> $matches["/\\[sup\\](.*?)\\[\\/sup\\]/is"] = function ($match) { return Html::sup($match[1]); }; // Replace [sub]...[/sub] with <sub>...</sub> $matches["/\\[sub\\](.*?)\\[\\/sub\\]/is"] = function ($match) { return Html::sub($match[1]); }; // Replace [i]...[/i] with <em>...</em> $matches["/\\[i\\](.*?)\\[\\/i\\]/is"] = function ($match) { return Html::em($match[1]); }; // Replace [code]...[/code] with <pre><code>...</code></pre> $matches["/\\[code\\](.*?)\\[\\/code\\]/is"] = function ($match) { return Html::code($match[1]); }; // Replace [quote]...[/quote] with <blockquote><p>...</p></blockquote> $matches["/\\[quote\\](.*?)\\[\\/quote\\]/is"] = function ($match) { return Html::quote($match[1]); }; // Replace [quote="person"]...[/quote] with <blockquote><p>...</p></blockquote> $matches["/\\[quote=\"([^\"]+)\"\\](.*?)\\[\\/quote\\]/is"] = function ($match) { return $match[1] . ' wrote: ' . Html::quote($match[2]); }; // Replace [size=30]...[/size] with <span style="font-size:30%">...</span> $matches["/\\[size=(\\d+)\\](.*?)\\[\\/size\\]/is"] = function ($match) { return Html::span($match[2], array('style' => 'font-size: ' . $match[1] . '%;')); }; // Replace [s] with <del> $matches["/\\[s\\](.*?)\\[\\/s\\]/is"] = function ($match) { return Html::del($match[1]); }; // Replace [u]...[/u] with <span style="text-decoration:underline;">...</span> $matches["/\\[u\\](.*?)\\[\\/u\\]/is"] = function ($match) { return Html::span($match[1], array('style' => 'text-decoration: underline;')); }; // Replace [center]...[/center] with <div style="text-align:center;">...</div> $matches["/\\[center\\](.*?)\\[\\/center\\]/is"] = function ($match) { return Html::span($match[1], array('style' => 'display: block; text-align: center;')); }; // Replace [color=somecolor]...[/color] with <span style="color:somecolor">...</span> $matches["/\\[color=([#a-z0-9]+)\\](.*?)\\[\\/color\\]/is"] = function ($match) { return Html::span($match[2], array('style' => 'color: ' . $match[1] . ';')); }; // Replace [email]...[/email] with <a href="mailto:...">...</a> $matches["/\\[email\\](.*?)\\[\\/email\\]/is"] = function ($match) { return Html::mailto($match[1], $match[1]); }; // Replace [email=someone@somewhere.com]An e-mail link[/email] with <a href="mailto:someone@somewhere.com">An e-mail link</a> $matches["/\\[email=(.*?)\\](.*?)\\[\\/email\\]/is"] = function ($match) { return Html::mailto($match[1], $match[2]); }; // Replace [url]...[/url] with <a href="...">...</a> $matches["/\\[url\\](.*?)\\[\\/url\\]/is"] = function ($match) { return Html::link($match[1], $match[1], array('target' => '_blank')); }; // Replace [url=http://www.google.com/]A link to google[/url] with <a href="http://www.google.com/">A link to google</a> $matches["/\\[url=(.*?)\\](.*?)\\[\\/url\\]/is"] = function ($match) { return Html::link($match[1], $match[2], array('target' => '_blank')); }; // Replace [img]...[/img] with <img src="..."/> $matches["/\\[img\\](.*?)\\[\\/img\\]/is"] = function ($match) { return Html::image($match[1]); }; // Replace [list]...[/list] with <ul><li>...</li></ul> $matches["/\\[list\\](.*?)\\[\\/list\\]/is"] = function ($match) { preg_match_all("/\\[\\*\\]([^\\[\\*\\]]*)/is", $match[1], $items); return Html::ul(preg_replace("/[\n\r?]\$/", null, $items[1])); }; // Replace [list=1|a]...[/list] with <ul|ol><li>...</li></ul|ol> $matches["/\\[list=(1|a)\\](.*?)\\[\\/list\\]/is"] = function ($match) { if ($match[1] === 'a') { $attr = array('style' => 'list-style-type: lower-alpha'); } preg_match_all("/\\[\\*\\]([^\\[\\*\\]]*)/is", $match[2], $items); return Html::ol(preg_replace("/[\n\r?]\$/", null, $items[1]), $attr); }; // Replace [youtube]...[/youtube] with <iframe src="..."></iframe> $matches["/\\[youtube\\](?:http?:\\/\\/)?(?:www\\.)?youtu(?:\\.be\\/|be\\.com\\/watch\\?v=)([A-Z0-9\\-_]+)(?:&(.*?))?\\[\\/youtube\\]/i"] = function ($match) { return Html::iframe('http://www.youtube.com/embed/' . $match[1], array('class' => 'youtube-player', 'type' => 'text/html', 'width' => 640, 'height' => 385, 'frameborder' => 0)); }; // Replace everything that has been found foreach ($matches as $key => $val) { $data = preg_replace_callback($key, $val, $data); } return nl2br(repl('<', '<', repl('>', '>', repl('"="', '', repl('"', "'", $data))))); }
function edit_GET(Web &$w) { $p = $w->pathMatch("id"); $w->Report->navigation($w, (!empty($p['id']) ? "Edit" : "Create") . " Report"); // Get or create report object $report = !empty($p['id']) ? $w->Report->getReport($p['id']) : new Report($w); if (!empty($p['id']) and empty($report->id)) { $w->error("Report not found", "/report"); } if (empty($report)) { History::add("Create Report"); } else { History::add("Edit Report: " . $report->title); } $w->ctx("report", $report); // If we're creating this is the table $form = array(array((!empty($report->id) ? "Edit" : "Create a New") . " Report", "section"), array("Title", "text", "title", $report->title), array("Module", "select", "module", $report->module, $w->Report->getModules()), array("Description", "textarea", "description", $report->description, "110", "2"), array("Code", "textarea", "report_code", $report->report_code, "110", "22", "codemirror"), array("Connection", "select", "report_connection_id", $report->report_connection_id, $w->Report->getConnections())); // DB view table $db_table = Html::form(array(array("Special Parameters", "section"), array("User", "static", "user", "{{current_user_id}}"), array("Roles", "static", "roles", "{{roles}}"), array("Site URL", "static", "webroot", "{{webroot}}"), array("View Database", "section"), array("Tables", "select", "dbtables", null, $w->Report->getAllDBTables()), array("Fields", "static", "dbfields", "<span id=\"dbfields\"></span>"))); $w->ctx("dbform", $db_table); if (!empty($report->id)) { $btnrun = Html::b("/report/runreport/" . $report->id, "Execute Report"); $w->ctx("btnrun", $btnrun); } // Check access rights // If user is editing, we need to check multiple things, detailed in the helper function if (!empty($report->id)) { // Get the report member object for the logged in user $member = $w->Report->getReportMember($report->id, $w->Auth->user()->id); // Check if user can edit this report if (!$w->Report->canUserEditReport($report, $member)) { $w->error("You do not have access to this report", "/report"); } } else { // If we're creating a report, check that the user has rights if ($w->Auth->user()->is_admin == 0 and !$w->Auth->user()->hasAnyRole(array('report_admin', 'report_editor'))) { $w->error("You do not have create report permissions", "/report"); } } // Access checked and OK, add approval to form only if is report_admin or admin if ($w->Auth->user()->is_admin == 1 or $w->Auth->user()->hasRole("report_admin")) { $form[0][] = array("Approved", "checkbox", "is_approved", $report->is_approved); } $w->ctx("report_form", Html::form($form, $w->localUrl("/report/edit/{$report->id}"), "POST", "Save Report")); if (!empty($report->id)) { // ============= Members tab =================== $members = $w->Report->getReportMembers($report->id); // set columns headings for display of members $line[] = array("Member", "Role", ""); // if there are members, display their full name, role and button to delete the member if ($members) { foreach ($members as $member) { $line[] = array($w->Report->getUserById($member->user_id), $member->role, Html::box("/report/editmember/" . $report->id . "/" . $member->user_id, " Edit ", true) . Html::box("/report/deletemember/" . $report->id . "/" . $member->user_id, " Delete ", true)); } } else { // if there are no members, say as much $line[] = array("Group currently has no members. Please Add New Members.", "", ""); } // display list of group members $w->ctx("viewmembers", Html::table($line, null, "tablesorter", true)); // =========== template tab ====================== $report_templates = $report->getTemplates(); // Build table $table_header = array("Title", "Category", "Type", "Actions"); $table_data = array(); if (!empty($report_templates)) { // Add data to table layout foreach ($report_templates as $report_template) { $template = $report_template->getTemplate(); $table_data[] = array($template->title, $template->category, $report_template->type, Html::box("/report-templates/edit/{$report->id}/{$report_template->id}", "Edit", true) . Html::b("/report-templates/delete/{$report_template->id}", "Delete", "Are you sure you want to delete this Report template entry?")); } } // Render table $w->ctx("templates_table", Html::table($table_data, null, "tablesorter", $table_header)); } }
<?php if ($w->Auth->user()->allowed("/inbox/send")) { echo Html::b($webroot . "/inbox/send", "Create Message"); } $button = new \Html\button(); if (!empty($read)) { echo $button->text("Archive")->onclick("sendArch()")->__toString(); // print "<button onclick='sendArch()'>Archive</button>"; echo $button->text("Delete")->onclick("deleteMessage()")->__toString(); // print "<button onclick='deleteMessage()'>Delete</button>"; } if ($read) { echo $read_table; $last_page = ceil($readtotal / 40); $minPage = $pgnum * 1 - 5; $minPage <= 0 ? $minPage = 1 : ''; //print $minPage . "\n"; $maxPage = $pgnum * 1 + 5; $maxPage > $last_page ? $maxPage = $last_page : ''; //print $maxPage . "\n"; //exit(); if ($last_page > 1) { print "<table style='margin:auto;'><tr id='nav'>"; if ($pgnum > 1) { print "<td style='background-color:#eee;' id='link" . $i . " prevlink' class='link' onclick='switchPage(" . ($pgnum - 1) . ")'><a class='link' href='#'>Prev</a></td> "; } for ($i = $minPage; $i <= $maxPage; $i++) { if ($pgnum == $i) { print "<td id='link" . $i . " ' class='link ispage' ><b>*" . $i . "*</b></td> "; } else {
?> </td> <td><?php echo formatDate($oc->d_end); ?> </td> <td><?php echo $oc->pays_electricity ? "YES" : "NO"; ?> <td><?php echo $oc->does_workhours ? "YES" : "NO"; ?> <td><?php echo Html::box("/bend-household/editoccupant/{$household->id}/{$oc->id}", "Edit", true); ?> <?php echo Html::b("/bend-household/deleteoccupant/{$household->id}/{$oc->id}", "Remove", "Are you certain to remove this occupant?"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } ?>
?> <td><?php echo $wp->getUser()->getFullName(); ?> </td> <td><?php echo $wp->getAccredited() ? $wp->getAccredited()->getFullName() : ""; ?> </td> <td><?php echo $wp->hours; ?> </td> <td> <?php echo Html::b("/bend-workhours/editworkentry/" . $wp->id, "Edit"); ?> </td> </tr> <?php } ?> <tr> <td colspan="7" style="text-align: center; font-size: 1.5em"> Total Hours Worked for this Period: <b><?php echo $total_worked; ?> </b>. Accredited to self: <b><?php echo $total_accredited; ?>
<?php if ($w->Auth->user()->allowed("/inbox/send")) { echo Html::b($webroot . "/inbox/send", "Create Message"); } $button = new \Html\button(); if (!empty($new)) { echo $button->text("Archive")->onclick("sendArch()")->__toString(); // print "<button onclick='sendArch()'>Archive</button>"; echo $button->text("Delete")->onclick("deleteMessage()")->__toString(); // print "<button onclick='deleteMessage()'>Delete</button>"; } if ($w->service('Inbox')->inboxCountMarker()) { echo Html::b($w->localUrl("/inbox/allread"), "Mark all read", "Are you sure to mark all messages as read?"); } if (!empty($new)) { // Print table echo $new_table; $last_page = ceil($newtotal / 40); $minPage = $pgnum * 1 - 5; $minPage <= 0 ? $minPage = 1 : ''; $maxPage = $pgnum * 1 + 5; $maxPage > $last_page ? $maxPage = $last_page : ''; if ($last_page > 1) { print "<table style='margin:auto;'><tr id='nav'>"; if ($pgnum > 1) { print "<td style='background-color:#eee;' id='link" . $i . " prevlink' class='link' onclick='switchPage(" . ($pgnum - 1) . ")'><a class='link' href='#'>Prev</a></td> "; } for ($i = $minPage; $i <= $maxPage; $i++) { if ($pgnum == $i) { print "<td id='link" . $i . " ' class='link ispage' ><b>*" . $i . "*</b></td> ";
<tr> <td><?php echo $household->streetnumber; ?> </td> <td><?php echo $household->is_chl ? "yes" : "no"; ?> </td> <td><?php echo $household->is_occupied ? "yes" : "no"; ?> </td> <td><?php echo Html::ab("/bend-household/show/{$lot->id}/{$household->id}", "Details", true); ?> <?php echo Html::b("/bend-lot/deletehousehold/{$lot->id}/{$household->id}", "Remove", "Are you certain to remove this household?"); ?> </td> </tr> <?php } ?> </tbody> </table> <?php } ?>