Exemplo n.º 1
0
function edit_GET(Web $w)
{
    $w->Admin->navigation($w, "Templates");
    $p = $w->pathMatch("id");
    $t = $w->Template->getTemplate($p['id']);
    $t = $t ? $t : new Template($w);
    $newForm = array();
    $newForm["Template Details"] = array(array(array("Title", "text", "title", $t->title), array("Active", "checkbox", "is_active", $t->is_active)), array(array("Module", "text", "module", $t->module), array("Category", "text", "category", $t->category)));
    $newForm['Description'] = array(array(array("", "textarea", "description", $t->description)));
    $w->ctx("editdetailsform", Html::multiColForm($newForm, $w->localUrl('/admin-templates/edit/' . $t->id)));
    $newForm = array();
    $newForm["Template Title"] = array(array(array("", "textarea", "template_title", $t->template_title, 100, 1, false)));
    $newForm["Template Body"] = array(array(array("", "textarea", "template_body", $t->template_body, 60, 100, "codemirror")));
    $w->ctx("templateform", Html::multiColForm($newForm, $w->localUrl('/admin-templates/edit/' . $t->id)));
    $newForm = array();
    $newForm["Title Data"] = array(array(array("", "textarea", "test_title_json", $t->test_title_json, 100, 5, false)));
    $newForm["Body Data"] = array(array(array("", "textarea", "test_body_json", $t->test_body_json, 100, 20, false)));
    $w->ctx("testdataform", Html::multiColForm($newForm, $w->localUrl('/admin-templates/edit/' . $t->id)));
    $w->ctx("id", $p['id']);
    //        try {
    //            $w->ctx("testtitle",$t->testTitle());
    //            $w->ctx("testbody",$t->testBody());
    //        } catch (Exception $e) {
    //            $w->ctx("testbody", "Error: Couldn't not render Twig template.<br/>Error Message: " . $e->getMessage());
    //        }
}
Exemplo n.º 2
0
function addcategory_GET(Web $w)
{
    list($parent_id) = $w->pathMatch("a");
    $parent = $w->Bend->getWorkCategoryForId($parent_id);
    $form = array("Category" => array(array(array("Title", "text", "title", "")), array(array("Description", "text", "description", ""))));
    $w->out(Html::multiColForm($form, "/bend-workhours/addcategory/{$parent_id}", "POST", "Save"));
}
Exemplo n.º 3
0
function edit_GET(Web $w)
{
    $p = $w->pathMatch("report_id", "id");
    $report_template = !empty($p['id']) ? $w->Report->getReportTemplate($p['id']) : new ReportTemplate($w);
    $form = array("Add Report Template" => array(array(array("Template", "select", "template_id", $report_template->template_id, $w->Template->findTemplates("report"))), array(array("Type", "select", "type", $report_template->type, $report_template->getReportTypes())), array(array("Report ID", "hidden", "report_id", $p['report_id']))));
    $w->out(Html::multiColForm($form, "/report-templates/edit/{$report_template->id}"));
}
Exemplo n.º 4
0
function editsettings_GET(Web $w)
{
    $w->setLayout(null);
    $p = $w->pathMatch("id");
    $id = $p["id"];
    if (!$id) {
        $w->error("Missing parameter in request", "/channels/listprocessors");
    }
    $processor = $w->Channel->getProcessor($id);
    if (empty($processor->id)) {
        $w->error("Invalid processor ID", "/channels/listprocessors");
    }
    // Instantiate processor
    $class = new $processor->class($w);
    if (method_exists($class, "getSettingsForm")) {
        // Call getSettingsForm
        $form = $class->getSettingsForm($processor->settings, $w);
        if (!empty($form)) {
            $w->out(Html::multiColForm($form, "/channels-processor/editsettings/{$processor->id}"));
        } else {
            $w->error("Form implementation is empty", "/channels/listprocessors");
        }
    } else {
        $w->error("Generic form settings function is missing", "/channels/listprocessors");
    }
}
Exemplo n.º 5
0
/**
* Display edit group dialog
*
* @param <type> $w
*/
function groupedit_GET(Web $w)
{
    $option = $w->pathMatch("group_id");
    $user = $w->Auth->getUser($option['group_id']);
    $template['Edit Group'] = array(array(array("Group Title: ", "text", "title", $user->login)));
    $w->out(Html::multiColForm($template, "/admin/groupedit/" . $option['group_id'], "POST", "Save"));
    $w->setLayout(null);
}
Exemplo n.º 6
0
function printfile_GET(Web $w)
{
    if (empty($_GET["filename"])) {
        $w->out("No filename specified");
    }
    $form = array("Print to" => array(array(array("Printer", "select", "printer_id", null, $w->Printer->getPrinters(), "null")), array(array("Filename", "hidden", "file", $_GET["filename"]))));
    $w->out(Html::multiColForm($form, "/admin/printfile", "POST", "Print", null, null, null, "_self", true, array("printer_id")));
}
Exemplo n.º 7
0
function edit_GET(Web $w)
{
    $p = $w->pathMatch("id");
    $user = !empty($p['id']) ? $w->Auth->getUser($p['id']) : new User($w);
    $template[($user->id ? "Edit" : "Create") . ' Group'] = array(array(array("Group Title", "text", "title", $user->login)));
    $w->out(Html::multiColForm($template, "/admin-groups/edit/" . $user->id));
    $w->setLayout(null);
}
Exemplo n.º 8
0
function editprinter_GET(Web $w)
{
    $p = $w->pathMatch("id");
    $printer = new Printer($w);
    if (!empty($p["id"])) {
        $printer = $w->Printer->getPrinter($p["id"]);
    }
    $form = array("Details" => array(array(array("Printer name", "text", "name", $printer->name)), array(array("Server", "text", "server", $printer->server)), array(array("Port", "text", "port", $printer->port))));
    $w->out(Html::multiColForm($form, "/admin/editprinter/{$p['id']}"));
}
Exemplo n.º 9
0
function editlot_GET(Web $w)
{
    list($id) = $w->pathMatch("id");
    $lot = new BendLot($w);
    if (!empty($id)) {
        $lot = $w->Bend->getLotForId($id);
    }
    $form = array("Lot" => array(array(array("Lot Number", "text", "lot_number", $lot->lot_number)), array(array("Occupancy", "select", "occupancy", $lot->occupancy, array("single", "dual")))));
    $w->out(Html::multiColForm($form, "/bend-lot/editlot/{$id}", "POST", "Save"));
}
Exemplo n.º 10
0
function editcategory_GET(Web $w)
{
    list($id) = $w->pathMatch("a");
    $cat = $w->Bend->getWorkCategoryForId($id);
    if (empty($cat)) {
        $w->error("no category found", "/bend-workhours/admin");
    }
    $form = array("Category" => array(array(array("Title", "text", "title", $cat->title)), array(array("Description", "text", "description", $cat->description))));
    $w->out(Html::multiColForm($form, "/bend-workhours/editcategory/{$id}", "POST", "Save"));
}
Exemplo n.º 11
0
function editperiod_GET(Web $w)
{
    list($periodid) = $w->pathMatch("a");
    $period = new BendWorkPeriod($w);
    if (!empty($periodid)) {
        $period = $w->Bend->getWorkPeriodForId($periodid);
    }
    $form["Work Period"] = array(array(array("Date From", "date", "d_start", !empty($period->d_start) ? formatDate($period->d_start) : ""), array("Date To", "date", "d_end", !empty($period->d_end) ? formatDate($period->d_end) : "")), array(array("Monthly Person Hours", "text", "monthly_person_hours", $period->monthly_person_hours), array("Is Closed?", "select", "is_closed", $period->is_closed, booleanNoYesForSelect())));
    $w->setLayout(null);
    $w->out(Html::multiColForm($form, "/bend-workhours/editperiod/{$periodid}", "POST", "Save"));
}
Exemplo n.º 12
0
function edit_GET(Web $w)
{
    $p = $w->pathMatch("id");
    $processor_id = $p["id"];
    $w->Channels->navigation($w, $processor_id ? "Edit" : "Add" . " a Processor");
    // Get channel and form
    $processor = $processor_id ? $w->Channel->getProcessor($processor_id) : new ChannelProcessor($w);
    $processor_list = $w->Channel->getProcessorList();
    $form = array("Processor" => array(array(array("Name", "text", "name", $processor->name)), array(array("Channel", "select", "channel_id", $processor->channel_id, $w->Channel->getChannels())), array(array("Processor Class", "select", "processor_class", $processor->module . '.' . $processor->class, $processor_list))));
    $w->out(Html::multiColForm($form, "/channels-processor/edit/{$processor_id}", "POST", "Save"));
}
Exemplo n.º 13
0
function addwidget_GET(Web $w)
{
    $p = $w->pathMatch("module");
    $module = $p["module"];
    $modulelist = $w->modules();
    $modules = array_filter($modulelist, function ($module) use(&$w) {
        $names = $w->Widget->getWidgetNamesForModule($module);
        return !empty($names);
    });
    $form = array("Add a widget" => array(array(array("Source module", "select", "source_module", null, $modules)), array(array("Widget Name", "select", "widget_name", null, array()))));
    $w->ctx("widgetform", Html::multiColForm($form, "/main/addwidget/{$module}", "POST", "Add"));
}
Exemplo n.º 14
0
function edit_GET(Web $w)
{
    $p = $w->pathMatch("id");
    $report_connection = new ReportConnection($w);
    if (!empty($p["id"])) {
        $report_connection = $w->Report->getConnection($p["id"]);
    }
    if (!empty($report_connection->id)) {
        $report_connection->decrypt();
    }
    $form = array("Connection" => array(array(array("Driver", "select", "db_driver", $report_connection->db_driver, PDO::getAvailableDrivers()), array("Host", "text", "db_host", $report_connection->db_host)), array(array("Port", "text", "db_port", $report_connection->db_port), array("Database", "text", "db_database", $report_connection->db_database)), array(array("Username", "text", "s_db_user", $report_connection->s_db_user), array("Password", "password", "s_db_password", $report_connection->s_db_password))));
    $w->out(Html::multiColForm($form, "/report-connections/edit/{$report_connection->id}"));
}
Exemplo n.º 15
0
function editworkentry_GET(Web $w)
{
    list($workentry_id) = $w->pathMatch("id");
    if (empty($workentry_id)) {
        $w->error("Missing an ID");
    }
    $workentry = $w->Bend->getWorkEntryForId($workentry_id);
    if (empty($workentry)) {
        $w->error("No work entry found for this id: " . $workentry_id);
    }
    $category = $workentry->getWorkCategory();
    list($category_1, $category_2, $category_3) = $category->getPath();
    $form["Work Hours"] = array(array($w->Auth->hasRole("bend_admin") ? array("Who did the work?", "select", "user_id", $workentry->user_id, $w->Bend->getOccupantUsers()) : array("Who did the work?", "static", "", $w->Auth->getUser($workentry->user_id)->getFullName()), array("Who to credit to", "select", "attributed_user_id", $workentry->attributed_user_id, $w->Bend->getOccupantUsers()), array("Date", "date", "d_date", formatDate($workentry->d_date)), array("Hours", "text", "hours", $workentry->hours)), array(array("Focus Group", "select", "category_1", defaultVal($category_1->id), $w->Bend->getTopLevelWorkCategories()), array("Team or Activity", "select", "category_2", defaultVal($category_2->id), !empty($category_1) ? $category_1->getChildren() : null), array("Activity", "select", "category_3", defaultVal($category_3->id), !empty($category_2) ? $category_2->getChildren() : null)), array(array("Description", "text", "description", $workentry->description)));
    $w->ctx("form", Html::multiColForm($form, "/bend-workhours/editworkentry/{$workentry_id}", "POST", "Save"));
}
Exemplo n.º 16
0
function edit_GET(Web $w)
{
    $p = $w->pathMatch("id");
    $channel_id = $p["id"];
    $w->Channels->navigation($w, $channel_id ? "Edit" : "Add" . " an Email Channel");
    // Get channel and form
    $channel_object = $channel_id ? $w->Channel->getChannel($channel_id) : new Channel($w);
    $form = $channel_object->getForm();
    $email_channel = $channel_id ? $w->Channel->getEmailChannel($channel_id) : new EmailChannelOption($w);
    // $folder_list = $email_channel->getFolderList();
    // Decrypt username and password
    $email_channel->decrypt();
    $form["Email"] = array(array(array("Protocol", "select", "protocol", $email_channel->protocol, $email_channel::$_select_protocol)), array(array("Server URL", "text", "server", $email_channel->server)), array(array("Username", "text", "s_username", $email_channel->s_username), array("Password", "password", "s_password", $email_channel->s_password)), array(array("Port", "text", "port", $email_channel->port), array("Use Auth?", "checkbox", "use_auth", $email_channel->use_auth)), array(array("Folder", "text", "folder", $email_channel->folder)));
    $form["Filter"] = array(array(array("To", "text", "to_filter", $email_channel->to_filter), array("From", "text", "from_filter", $email_channel->from_filter)), array(array("CC", "text", "cc_filter", $email_channel->cc_filter), array("Subject", "text", "subject_filter", $email_channel->subject_filter)), array(array("Body", "text", "body_filter", $email_channel->body_filter)));
    $form["Action"] = array(array(array("Post Read Action", "select", "post_read_action", $email_channel->post_read_action, $email_channel::$_select_read_action), array("Post Read Data", "text", "post_read_parameter", $email_channel->post_read_parameter)));
    $w->ctx("form", Html::multiColForm($form, "/channels-email/edit/{$channel_id}", "POST", "Save", "channelform"));
}
Exemplo n.º 17
0
function edit_GET(Web $w)
{
    list($lotId, $householdid) = $w->pathMatch("lotId", "householdid");
    if (empty($lotId)) {
        $w->out("no lot id provided");
        return;
    }
    $lot = $w->Bend->getLotForId($lotId);
    $household = new BendHousehold($w);
    if (!empty($householdid)) {
        $household = $w->Bend->getHouseholdForId($householdid);
    }
    $form["Lot"] = array(array(array("Lot Number", "static", "", $lot->lot_number), array("Occupancy", "static", "", $lot->occupancy)));
    $form["Household"] = array(array(array("Streetnumber", "text", "streetnumber", $household->streetnumber), array("Is CHL", "select", "is_chl", $household->is_chl, lookupForSelect($w, "YesNo")), array("Is Occupied", "select", "is_occupied", $household->is_occupied, lookupForSelect($w, "YesNo")), array("Number of Occupants", "text", "num_occupants", $household->num_occupants)));
    $w->setLayout(null);
    $w->out(Html::multiColForm($form, "/bend-household/edit/{$lotId}/{$household->id}", "POST", "Save"));
}
Exemplo n.º 18
0
/**
* Add new members to a group
*
* @param <type> $w
*/
function groupmember_GET(Web $w)
{
    $option = $w->pathMatch("group_id");
    $users = $w->Auth->getUsersAndGroups();
    foreach ($users as $user) {
        $name = $user->is_group == 1 ? strtoupper($user->login) : $user->getContact()->getFullName();
        $select[$user->is_group][$name] = array($name, $user->id);
    }
    ksort($select[0]);
    ksort($select[1]);
    $template['New Member'] = array(array(array("Select Member: ", "select", "member_id", null, array_merge($select[0], $select[1]))));
    if ($w->Auth->user()->is_admin) {
        $template['New Member'][0][] = array("Owner", "checkbox", "is_owner");
    }
    $w->out(Html::multiColForm($template, "/admin/groupmember/" . $option['group_id'], "POST", "Save"));
    $w->setLayout(null);
}
Exemplo n.º 19
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 "));
}
Exemplo n.º 20
0
function editoccupant_GET(Web $w)
{
    list($householdid, $occupantid) = $w->pathMatch("a", "b");
    if (empty($householdid)) {
        $w->error("Need a household ID");
    }
    $household = $w->Bend->getHouseholdForId($householdid);
    if (empty($household)) {
        $w->error("Household not found");
    }
    $oc = new BendHouseholdOccupant($w);
    $contact = new Contact($w);
    if (!empty($occupantid)) {
        $oc = $w->Bend->getHouseholdOccupantForId($occupantid);
        $contact = $oc->getContact();
    }
    $form["Household"] = array(array(array("Street Number", "static", "", $household->streetnumber), array("Is CHL?", "static", "", $household->is_chl ? "yes" : "no"), array("Is Occupied?", "static", "", $household->is_occupied ? "yes" : "no")));
    $form["Occupant"] = array(array(array("Occupant From", "date", "d_start", !empty($oc->d_start) ? formatDate($oc->d_start) : ""), array("Occupant To", "date", "d_end", !empty($oc->d_end) ? formatDate($oc->d_end) : "")), array(array("Pays Electricity?", "select", "pays_electricity", $oc->pays_electricity, lookupForSelect($w, "YesNo")), array("Does Workhours?", "select", "does_workhours", $oc->does_workhours, lookupForSelect($w, "YesNo"))));
    $form["Occupant Contact"] = array(array(empty($oc->user_id) ? array("Select Existing User", "select", "user_id", null, $w->Auth->getUsers()) : array("User", "static", "", $oc->getFullName())), array(array("First Name", "text", "firstname", $contact->firstname), array("Last Name", "text", "lastname", $contact->lastname), array("Email", "text", "email", $contact->email)), array(array("Home Phone", "text", "homephone", $contact->homephone), array("Work Phone", "text", "workphone", $contact->workphone), array("Mobile Phone", "text", "mobile", $contact->mobile)));
    $w->ctx("form", Html::multiColForm($form, "/bend-household/editoccupant/{$householdid}/{$occupantid}", "POST", "Save"));
}
Exemplo n.º 21
0
function editlotowner_GET(Web $w)
{
    list($lotId, $lotOwnerId) = $w->pathMatch("lotId", "lotOwnerId");
    if (empty($lotId)) {
        $w->out("no lot id provided");
        return;
    }
    $lot = $w->Bend->getLotForId($lotId);
    $lotOwner = new BendLotOwner($w);
    $user = new User($w);
    $contact = new Contact($w);
    if (!empty($lotOwnerId)) {
        $lotOwner = $w->Bend->getBendLotOwnerForId($lotOwnerId);
        $user = $lotOwner->getUser();
        $contact = $lotOwner->getContact();
    }
    $form["Lot"] = array(array(array("Lot Number", "static", "", $lot->lot_number), array("Occupancy", "static", "", $lot->occupancy)), array(array("Owner From", "date", "d_start", !empty($lotOwner->d_start) ? formatDate($lotOwner->d_start) : ""), array("Owner To", "date", "d_end", !empty($lotOwner->d_end) ? formatDate($lotOwner->d_end) : "")));
    $form["Owner Contact"] = array(array(empty($lotOwner->user_id) ? array("Select Existing User", "select", "user_id", null, $w->Auth->getUsers()) : array("User", "static", "", $lotOwner->getContact()->getFullName())), array(array("First Name", "text", "firstname", $contact->firstname), array("Last Name", "text", "lastname", $contact->lastname), array("Email", "text", "email", $contact->email)), array(array("Home Phone", "text", "homephone", $contact->homephone), array("Work Phone", "text", "workphone", $contact->workphone), array("Mobile Phone", "text", "mobile", $contact->mobile)));
    $form["Owner Address"] = array(array(array("Address1", "text", "address1", $lotOwner->address1), array("Address2", "text", "address2", $lotOwner->address2)), array(array("Town", "text", "town", $lotOwner->town), array("Postcode", "text", "postcode", $lotOwner->postcode), array("State", "select", "state", $lotOwner->state, getStateSelectArray())));
    $w->ctx("form", Html::multiColForm($form, "/bend-lot/editlotowner/{$lotId}/{$lotOwnerId}", "POST", "Save"));
}
Exemplo n.º 22
0
function permissionedit_GET(Web $w)
{
    $option = $w->pathMatch("group_id");
    $user = $w->Auth->getUser($option['group_id']);
    $userName = $user->is_group == 1 ? $user->login : $user->getContact()->getFullName();
    $w->Admin->navigation($w, "Permissions - " . $userName);
    //fill in permission tables;
    $groupUsers = $w->Auth->getUser($option['group_id'])->isInGroups();
    $groupRoles = array();
    if ($groupUsers) {
        foreach ($groupUsers as $groupUser) {
            $grs = $groupUser->getGroup()->getRoles();
            foreach ($grs as $gr) {
                $groupRoles[] = $gr;
            }
        }
    }
    $allroles = $w->Auth->getAllRoles();
    foreach ($allroles as $role) {
        $parts = explode("_", $role);
        if (count($parts) == 1) {
            array_unshift($parts, "admin");
        }
        $module = array_shift($parts);
        $result[$module][] = implode("_", $parts);
    }
    $permission = array();
    foreach ($result as $module => $parts) {
        $parts = array_chunk($parts, 4);
        foreach ($parts as $level => $roles) {
            foreach ($roles as $r) {
                $roleName = $module == "admin" ? $r : implode("_", array($module, $r));
                $permission[ucwords($module)][$level][] = array($roleName, "checkbox", "check_" . $roleName, $w->Auth->getUser($option['group_id'])->hasRole($roleName));
            }
        }
    }
    $action = $w->Auth->user()->is_admin ? "/admin/permissionedit/" . $option['group_id'] : null;
    $w->ctx("permission", Html::multiColForm($permission, $action));
    $w->ctx("groupRoles", json_encode($groupRoles));
}
Exemplo n.º 23
0
function configwidget_GET(Web $w)
{
    $p = $w->pathMatch("origin", "id");
    // "origin", "source", "widget");
    // $widget = $w->Widget->getWidget($p["origin"], $p["source"], $p["widget"]);
    $widget = $w->Widget->getWidgetById($p["id"]);
    // $widgetname = $p["widget"];
    if (empty($widget->id)) {
        $w->error("Widget not found", "/{$p['origin']}");
    }
    $widgetname = $widget->widget_name;
    $widget_config = null;
    if (class_exists($widgetname)) {
        $widget_config = new $widgetname($w, $widget);
    }
    if (!empty($widget_config)) {
        $w->out(Html::multiColForm($widget_config->getSettingsForm(), "/main/configwidget/{$p['origin']}/{$p['id']}"));
        // {$p['origin']}/{$p['source']}/{$p['widget']}"));
    } else {
        $w->out("Could not find widget class ({$widgetname})");
    }
}
Exemplo n.º 24
0
<?php

$form['User Details'][] = array(array("Login", "text", "login"), array("Admin", "checkbox", "is_admin"), array("Active", "checkbox", "is_active"));
$form['User Details'][] = array(array("Password", "password", "password"), array("Repeat Password", "password", "password2"));
$form['Contact Details'][] = array(array("First Name", "text", "firstname"), array("Last Name", "text", "lastname"));
$form['Contact Details'][] = array(array("Title", "select", "title", null, lookupForSelect($w, "title")), array("Email", "text", "email"));
$roles = $w->Auth->getAllRoles();
$roles = array_chunk($roles, 4);
foreach ($roles as $r) {
    $row = array();
    foreach ($r as $rf) {
        $row[] = array($rf, "checkbox", "check_" . $rf);
    }
    $form['User Roles'][] = $row;
}
print Html::multiColForm($form, $w->localUrl("/admin/useradd"), "POST", "Save");
Exemplo n.º 25
0
/**
 * Display add group dialog
 *
 * @param <type> $w
 */
function groupadd_GET(Web $w)
{
    $template['New Group'] = array(array(array("Group Title: ", "text", "title")));
    $w->out(Html::multiColForm($template, "/admin/groupadd", "POST", "Save"));
    $w->setLayout(null);
}
Exemplo n.º 26
0
function addgroupmembers_GET(Web &$w)
{
    $p = $w->pathMatch("task_group_id");
    // get all users
    $users = $w->Auth->getUsers();
    // not interested in users who are really groups
    foreach ($users as $user) {
        if ($user->is_group == "0") {
            $usr[] = $user;
        }
    }
    // build 'add members' form given task group ID, the list of group roles and the list of users.
    // if current members are added as if new, their membership will be updated, not recreated, with the selected role
    $addUserForm['Add Group Members'] = array(array(array("", "hidden", "task_group_id", $p['task_group_id'])), array(array("As Role", "select", "role", "", $w->Task->getTaskGroupPermissions())), array(array("Add Group Members", "select", "member", null, $usr)));
    //	$w->setLayout(null);
    $w->out(Html::multiColForm($addUserForm, $w->localUrl("/task-group/updategroupmembers/"), "POST", " Submit "));
}
Exemplo n.º 27
0
    $contact = $user->getContact();
    $form['User Details'][] = array(array("Login", "text", "login", $user->login), array("Admin", "checkbox", "is_admin", $user->is_admin), array("Active", "checkbox", "is_active", $user->is_active));
    $form['User Details'][] = array(array("Password", "password", "password"), array("Repeat Password", "password", "password2"));
    $form['Contact Details'][] = array(array("First Name", "text", "firstname", $contact ? $contact->firstname : ""), array("Last Name", "text", "lastname", $contact ? $contact->lastname : ""));
    $form['Contact Details'][] = array(array("Title", "select", "title", $contact ? $contact->title : "", lookupForSelect($w, "title")), array("Email", "text", "email", $contact ? $contact->email : ""));
    $groupUsers = $user->isInGroups();
    if ($groupUsers) {
        foreach ($groupUsers as $groupUser) {
            $group = $groupUser->getGroup();
            $groups[] = " - " . Html::a("/admin/moreInfo/" . $group->id, $group->login);
        }
    } else {
        $groups = array();
    }
    $form['User Groups'][] = array(array("Group Title", "static", "groupName", implode("<br/>", $groups)));
    print Html::multiColForm($form, $w->localUrl("/admin/useredit/" . $w->ctx("id")), "POST", "Save");
    ?>

<?php 
} else {
    ?>
<div class="error">User with ID <?php 
    echo $id;
    ?>
 does not exist.</div>
<?php 
}
?>

<script type="text/javascript">
	$(".form-section").attr("width","");
Exemplo n.º 28
0
function enter_GET(Web $w)
{
    History::add("Enter Workhours");
    $form["Work Hours"] = array(array($w->Auth->hasRole("bend_admin") ? array("Who did the work?", "select", "user_id", $w->Auth->user()->id, $w->Bend->getOccupantUsers()) : array("Who did the work?", "static", "", $w->Auth->user()->getFullName()), array("Who to credit to", "select", "attributed_user_id", $w->Auth->user()->id, $w->Bend->getOccupantUsers()), array("Date", "date", "d_date"), array("Hours", "text", "hours")), array(array("Focus Group", "select", "category_1", null, $w->Bend->getTopLevelWorkCategories()), array("Team or Activity", "select", "category_2", null), array("Activity", "select", "category_3", null)), array(array("Description", "text", "description", "")));
    $w->ctx("form", Html::multiColForm($form, "/bend-workhours/enter", "POST", "Save"));
}
Exemplo n.º 29
0
function gitpull_GET(Web $w)
{
    $form = array("Path to Git" => array(array(array("Path to Git", "text", "git"))), "Branch" => array(array(array("Branch", "text", "branch"))));
    $w->out(Html::multiColForm($form, "/admin/gitpull", "POST", "Go"));
}
Exemplo n.º 30
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"));
    }
}