Example #1
0
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);
}
Example #2
0
/**
 * @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));
}
Example #3
0
/**
* 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));
}
Example #4
0
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));
}
Example #5
0
/**
* 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));
}
Example #6
0
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);
}
Example #7
0
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));
}
Example #8
0
function viewmembergroup_GET(Web $w)
{
    $p = $w->pathMatch("id");
    // tab: Members
    // get all members in a task group given a task group ID
    $member_group = $w->Task->getMemberGroup($p['id']);
    // get the group attributes given a task group ID
    $group = $w->Task->getTaskGroup($p['id']);
    // put the group title into the page heading
    $w->Task->navigation($w, "Task Group - " . $group->title);
    History::add("Task Group: " . $group->title);
    // set columns headings for display of members
    $line[] = array("Member", "Role", "");
    // if their are members, display their full name, role and buttons to edit or delete the member
    if ($member_group) {
        foreach ($member_group as $member) {
            $line[] = array($w->Task->getUserById($member->user_id), $member->role, Html::box(WEBROOT . "/task-group/viewmember/" . $member->id, " Edit ", true) . "&nbsp;&nbsp;" . Html::box(WEBROOT . "/task-group/deletegroupmember/" . $member->id, " Delete ", true));
        }
    } else {
        // if there are no members, say as much
        $line[] = array("Group currently has no members. Please Add New Members.", "", "");
    }
    // enter task group attributes sa query string for buttons providing group specific functions such as delete or add members
    $w->ctx("taskgroup", $group->task_group_type);
    $w->ctx("grpid", $group->id);
    $w->ctx("groupid", $p['id']);
    // display list of group members
    $w->ctx("viewmembers", Html::table($line, null, "tablesorter", true));
    // tab:  Notify
    $notify = $w->Task->getTaskGroupNotify($group->id);
    if ($notify) {
        foreach ($notify as $n) {
            $v[$n->role][$n->type] = $n->value;
        }
    } else {
        $v['guest']['creator'] = 0;
        $v['member']['creator'] = 0;
        $v['member']['assignee'] = 0;
        $v['owner']['creator'] = 0;
        $v['owner']['assignee'] = 0;
        $v['owner']['other'] = 0;
    }
    $notifyForm['Task Group Notifications'] = array(array(array("", "hidden", "task_group_id", $group->id)), array(array("", "static", ""), array("Creator", "static", "creator"), array("Assignee", "static", "assignee"), array("All Others", "static", "others")), array(array("Guest", "static", "guest"), array("", "checkbox", "guest_creator", $v['guest']['creator'])), array(array("Member", "static", "member"), array("", "checkbox", "member_creator", $v['member']['creator']), array("", "checkbox", "member_assignee", $v['member']['assignee'])), array(array("Owner", "static", "owner"), array("", "checkbox", "owner_creator", $v['owner']['creator']), array("", "checkbox", "owner_assignee", $v['owner']['assignee']), array("", "checkbox", "owner_other", $v['owner']['other'])));
    $w->ctx("notifymatrix", Html::multiColForm($notifyForm, $w->localUrl("/task-group/updategroupnotify/"), "POST", " Submit "));
}
Example #9
0
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));
}
Example #10
0
 static function viewMemberstab(Web &$w, $id)
 {
     // return list of members of given report
     $members = $w->Report->getReportMembers($id);
     // get report details
     $report = $w->Report->getReportInfo($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) . "&nbsp;&nbsp;" . 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.", "", "");
     }
     $w->ctx("reportid", $report->id);
     // display list of group members
     $w->ctx("viewmembers", Html::table($line, null, "tablesorter", true));
 }
Example #11
0
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"));
    }
}
Example #12
0
                    <td><?php 
        echo !empty($channel->name) ? $channel->name : "";
        ?>
</td>
                    <td>
                        <?php 
        echo Html::box("/channels-processor/edit/{$p->id}", "Edit");
        ?>
                        <?php 
        echo Html::a("/channels-processor/delete/{$p->id}", "Delete", null, null, "Are you sure you want to delete " . (!empty($p->name) ? $p->name : "this processor") . "?");
        ?>
                        <?php 
        // Only show edit settings form if it returns something
        $class = new $p->class($w);
        if (method_exists($class, "getSettingsForm")) {
            $form = $class->getSettingsForm($p->settings);
            if (!empty($form)) {
                echo Html::box("/channels-processor/editsettings/{$p->id}", "Edit Settings");
            }
        }
        ?>
                    </td>
                </tr>	
            <?php 
    }
    ?>
        </tbody>
    </table>

<?php 
}
Example #13
0
</td>
                        <td><?php 
            echo $base_channel->is_active ? "ON" : "OFF";
            ?>
</td>
                        <td><?php 
            echo $base_channel->notify_user_email;
            ?>
</td>
                        <td><?php 
            $user = $base_channel->getNotifyUser();
            echo !empty($user->id) ? $user->getFullName() : "";
            ?>
                        <td>
                            <?php 
            echo Html::box("/channels-{$c->_channeltype}/edit/{$base_channel->id}", "Edit");
            ?>
                            <?php 
            echo Html::a("/channels-email/delete/{$base_channel->id}", "Delete", null, null, "Are you sure you want to delete " . (!empty($base_channel->name) ? addslashes($base_channel->name) : "this channel") . "?");
            ?>
                            <?php 
            echo Html::a("/channels/listmessages/{$base_channel->id}", "Messages");
            ?>
                        </td>
                    </tr>
                <?php 
        }
        ?>
            <?php 
    }
    ?>
Example #14
0
</td>
		</tr>
        <?php 
        }
    }
    ?>
	</tbody>
</table>
<?php 
}
?>

<hr/>
<h2>Households</h2>
<?php 
echo Html::box("/bend-household/edit/" . $lot->id, "Add Household", true);
if (!empty($households)) {
    ?>
<table width="80%">
	<thead>
       <tr>
            <th>Street Number</th>
			<th>CHL?</th>
			<th>Occupied?</th>
            <th>Actions</th>
        </tr>
	</thead>
    <tbody>
		<?php 
    foreach ($households as $household) {
        ?>
Example #15
0
?>
        </div>
        <?php 
if (!empty($report->id)) {
    ?>
            <div id="templates">
                <?php 
    echo Html::box("/report-templates/edit/{$report->id}", "Add Template", true);
    ?>
                <?php 
    echo !empty($templates_table) ? $templates_table : "";
    ?>
            </div>
            <div id="members" style="display: none;" class="clearfix">
                <?php 
    echo Html::box("/report/addmembers/" . $report->id, " Add New Members ", true);
    ?>
                <?php 
    echo $viewmembers;
    ?>
            </div>
        <?php 
}
?>
        <div id="database" style="display: none;" class="clearfix">
            <?php 
echo $dbform;
?>
        </div>
    </div>
</div>
Example #16
0
<h1><?php 
echo $message;
?>
</h1>
<?php 
echo Html::box("/kickstart/new", "Kickstart module", true);
echo $table;
Example #17
0
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']);
}
Example #18
0
<!--
<div id="users-filter">
    <form>
        <table>
            <tr><td>Show Only Active Users</td><td><input type="checkbox" name="show_active"/></td></tr>
            <tr><td colspan="2"><input type="submit" value="Filter"/></td></tr>
        </table>
    </form>
</div>
-->
<?php 
echo Html::box($webroot . "/admin/useradd/box", "Add New User", true);
echo $table;
Example #19
0
<?php

echo Html::box("/admin/editprinter", "Add a printer", true);
echo Html::table($table_data, null, "tablesorter", $table_header);
Example #20
0
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");
    }
}
Example #21
0
                    </span>
                <?php 
}
?>
                <?php 
if (empty($displayOnly)) {
    ?>
<a class="comment_reply">Reply</a><?php 
}
?>
                <?php 
if ($c->w->Auth->user()->id == $c->creator_id && empty($displayOnly)) {
    ?>
                    <span style='float: right;'>
                        <?php 
    echo Html::box("/admin/comment/{$c->id}/{$c->obj_table}/{$c->obj_id}?redirect_url=" . $redirect, "Edit", false);
    ?>
                        or
                        <?php 
    echo Html::a("/admin/deletecomment/{$c->id}?redirect_url=" . $redirect, "Delete", null, null, "Are you sure you want to delete this comment?");
    ?>
                    </span>
                <?php 
}
?>
            </div>
        </div>    
    </div>
    <?php 
echo empty($displayOnly) ? $w->partial("loopcomments", array("object" => $w->Comment->getCommentsForTable($c->getDbTableName(), $c->id), "redirect" => $redirect), "admin") : "";
?>
Example #22
0
function tasklist_ALL(Web $w)
{
    History::add("List Tasks");
    // Look for reset
    $reset = $w->request("reset");
    if (empty($reset)) {
        // Get filter values
        $assignee_id = $w->request("assignee_id");
        $creator_id = $w->request("creator_id");
        $task_group_id = $w->request("task_group_id");
        $task_type = $w->request('task_type');
        $task_priority = $w->request('task_priority');
        $task_status = $w->request('task_status');
        $is_closed = $w->request("is_closed");
        $dt_from = $w->request('dt_from');
        $dt_to = $w->request('dt_to');
    }
    // Make the query manually
    $query_object = $w->db->get("task")->leftJoin("task_group");
    // We can now make ID queries directly to the task_group table because of left join
    if (!empty($task_group_id)) {
        $query_object->where("task_group.id", $task_group_id);
    }
    // Repeat above for everything else
    if (!empty($assignee_id)) {
        $query_object->where("task.assignee_id", $assignee_id);
    }
    if (!empty($creator_id)) {
        // $query_object->where("task.creator_id", $creator_id);
    }
    if (!empty($task_type)) {
        $query_object->where("task.task_type", $task_type);
    }
    if (!empty($task_priority)) {
        $query_object->where("task.priority", $task_priority);
    }
    if (!empty($task_status)) {
        $query_object->where("task.status", $task_status);
    }
    if (!empty($is_closed)) {
        $query_object->where("task.is_closed", is_null($is_closed) || $is_closed == 0 ? 0 : 1);
    } else {
        $query_object->where("task.is_closed", 0);
    }
    // This part is why we want to make our query manually
    if (!empty($dt_from)) {
        $query_object->where("task.dt_due >= ?", $dt_from);
    }
    if (!empty($dt_to)) {
        $query_object->where("task_dt_due <= ?", $dt_to);
    }
    // Standard wheres
    $query_object->where("task.is_deleted", array(0, null))->where("task_group.is_active", 1)->where("task_group.is_deleted", 0);
    // Fetch dataset and get model objects for them
    $tasks_result_set = $query_object->fetch_all();
    $task_objects = $w->Task->getObjectsFromRows("Task", $tasks_result_set);
    $w->ctx("tasks", $task_objects);
    // Build the filter and its data
    $taskgroup_data = $w->Task->getTaskGroupDetailsForUser();
    $filter_data = array(array("Assignee", "select", "assignee_id", !empty($assignee_id) ? $assignee_id : null, $taskgroup_data["members"]), array("Creator", "select", "creator_id", !empty($creator_id) ? $creator_id : null, $taskgroup_data["members"]), array("Task Group", "select", "task_group_id", !empty($task_group_id) ? $task_group_id : null, $taskgroup_data["taskgroups"]), array("Task Type", "select", "task_type", !empty($task_type) ? $task_type : null, $taskgroup_data["types"]), array("Task Priority", "select", "task_priority", !empty($task_priority) ? $task_priority : null, $taskgroup_data["priorities"]), array("Task Status", "select", "task_status", !empty($task_status) ? $task_status : null, $taskgroup_data["statuses"]), array("Closed", "checkbox", "is_closed", !empty($is_closed) ? $is_closed : null));
    $w->ctx("filter_data", $filter_data);
    // tab: notifications
    // list groups and notification based on my role and permissions
    $line = array(array("Task Group", "Your Role", "Creator", "Assignee", "All Others", ""));
    $user_taskgroup_members = $w->Task->getMemberGroups($w->Auth->user()->id);
    if ($user_taskgroup_members) {
        usort($user_taskgroup_members, array("TaskService", "sortbyRole"));
        foreach ($user_taskgroup_members as $member) {
            $taskgroup = $member->getTaskGroup();
            $value_array = array();
            $notify = $w->Task->getTaskGroupUserNotify($w->Auth->user()->id, $member->task_group_id);
            if ($notify) {
                foreach ($notify as $n) {
                    $value = $n->value == "0" ? "No" : "Yes";
                    $value_array[$n->role][$n->type] = $value;
                }
            } else {
                $notify = $w->Task->getTaskGroupNotify($member->task_group_id);
                if ($notify) {
                    foreach ($notify as $n) {
                        $value = $n->value == "0" ? "No" : "Yes";
                        $value_array[$n->role][$n->type] = $value;
                    }
                }
            }
            if ($taskgroup->getCanIView()) {
                $title = $w->Task->getTaskGroupTitleById($member->task_group_id);
                $role = strtolower($member->role);
                $line[] = array($title, ucfirst($role), @$value_array[$role]["creator"], @$value_array[$role]["assignee"], @$value_array[$role]["other"], Html::box(WEBROOT . "/task/updateusergroupnotify/" . $member->task_group_id, " Edit ", true));
            }
            unset($value_array);
        }
        // display list
        $w->ctx("notify", Html::table($line, null, "tablesorter", true));
    }
}
Example #23
0
 /**
  * Convenience Method for creating menu's
  * This will check if $path is allowed
  * and will then return an html link or nothing
  *
  * This will create a link which will open a popup box
  *
  * if $array is set will also add the link to the array
  *
  * @param string $path
  * @param string $title
  * @param array $array
  */
 function menuBox($path, $title, &$array = null)
 {
     $link = $this->Auth->allowed($path, Html::box($this->localUrl($path), $title));
     if ($array !== null) {
         $array[] = $link;
     }
     return $link;
 }
Example #24
0
if (isset($_REQUEST['logout']) && $_REQUEST['logout'] || isset($logout) && $logout) {
    $user->logout($idsession);
}
$link = "?language=" . $lang;
if (!empty($idsession)) {
    $link .= "&amp;idsession=" . $idsession;
}
if ($user->error) {
    printf($html->string_error, $user->error);
}
if ($user->authenticated == 1) {
    if (isset($_REQUEST)) {
        $zonename = $_REQUEST['zonename'];
        $zonetype = $_REQUEST['zonetype'];
        $server = $_REQUEST['server'];
    }
    $zone = new Zone($zonename, $zonetype);
    if ($zone->error) {
        printf($html->string_error, $zone->error);
    } else {
        if ($zone->RetrieveUser() != $user->userid && ($config->usergroups && $zone->RetrieveUser() != $group->groupid)) {
            printf($html->string_error, $l['str_you_dont_own_this_zone']);
        } else {
            $title = sprintf($l['str_zone_content_for_x_on_server_x'], $zone->zonename, xssafe($server));
            $content = sprintf("\n<pre>%s</pre>", xssafe(zoneDig($server, $zonename)));
            print $html->box('digwindow', $title, $content);
        }
    }
}
// print close "window"
print $html->footerlight();
Example #25
0
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));
    }
}
Example #26
0
<h1><?php 
echo $message;
?>
</h1>
<?php 
echo Html::box("/sprints/edit", "New Sprint", true);
echo $table;
Example #27
0
			<td><?php 
        echo formatDate($oc->d_start);
        ?>
</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 
}
?>
<?php

echo Html::box(WEBROOT . "/file/attach/" . get_class($object) . "/{$object->id}/" . str_replace("/", "+", $redirect), "Attach a File", true);
$notImages = array();
if (!empty($attachments)) {
    ?>
        <br/><br/>
        <ul class="clearing-thumbs small-block-grid-2 medium-block-grid-6 large-block-grid-9" data-clearing>
        <?php 
    foreach ($attachments as $att) {
        ?>
            <?php 
        if ($att->isImage()) {
            ?>
                <li><a class="th" href="/uploads/<?php 
            echo $att->fullpath;
            ?>
"><img data-caption="<?php 
            echo $att->title;
            ?>
" src="<?php 
            echo $att->getThumbnailUrl();
            ?>
"></a></li>
            <?php 
        } else {
            $notImages[] = $att;
        }
    }
    ?>
        </ul>
Example #29
0
 /**
  *
  * Returns html code for a thumbnail link to download this attachment
  */
 function getThumb()
 {
     return Html::box($this->File->getDownloadUrl($this->fullpath), $this->File->getThumbImg($this->fullpath));
 }
<h1><?php 
echo $message;
?>
</h1>
<?php 
echo Html::box("/###MODULE_NAME###/edit", "New ###MODULE_NAME_UC###", true);
echo $table;