示例#1
0
 /**
  * Returns the HTML for the courseInfo form. Makes it possible to either
  * create a new form or to edit an old one. 
  * 
  * @param type $lang_id
  * @param Kurssitieto $courseInfo Kurssitieto object.
  * @return type
  */
 public function show_courseInfo_form($lang_id, &$courseInfo)
 {
     // Default values (new object):
     $new = true;
     $description = "";
     $teacher_name = "";
     $course_code = "";
     $visibility_value = Nakyvyys::$JULKINEN;
     // Old object to be modified:
     if ($courseInfo->olio_loytyi_tietokannasta) {
         $new = false;
         // Htmlspecialchars: Management of special signs etc.
         $description = htmlspecialchars($courseInfo->get_arvo(Kurssitieto::$sarakenimi_kuvaus), ENT_QUOTES, "UTF-8", true);
         $teacher_name = htmlspecialchars($courseInfo->get_arvo(Kurssitieto::$sarakenimi_opettaja_nimi), ENT_QUOTES, "UTF-8", true);
         $course_code = htmlspecialchars($courseInfo->get_arvo(Kurssitieto::$sarakenimi_tunniste), ENT_QUOTES, "UTF-8", true);
         $visibility_value = $courseInfo->get_arvo(Kurssitieto::$sarakenimi_nakyvyys);
     }
     // Visibility choises: ====================================================
     $default = $visibility_value;
     $visibility_object = new Perusnakyvyys();
     $select_attr_array = array(Attr::name(Palautuskontrolleri::$kurssitieto_name_nakyvyys), Attr::title(Palautustekstit::visibility($lang_id)), Attr::classs("form-control"), Attr::id("course_visibility"));
     $option_attr_array = array();
     $visibility_dropdown_elem = $visibility_object->luo_pudotusvalikko($select_attr_array, $option_attr_array, $default, "");
     //======================================================================
     $save_button = $this->create_button_save_edit_courseInfo($lang_id);
     $info = Palautustekstit::courseInfo_edit_form_instruction($lang_id);
     if ($new) {
         $save_button = $this->create_button_save_new_courseInfo($lang_id);
         $info = Palautustekstit::courseInfo_new_form_instruction($lang_id);
     }
     $html = Html::luo_otsikko($info, array(), 2) . Html::form(array(Attr::classs("form-horizontal")), Html::div(array(Attr::classs("form-group")), Html::luo_label_for("course_code_text_field", Palautustekstit::course_code($lang_id), array(Attr::classs("control-label col-sm-2"))) . Html::div(array(Attr::classs("col-sm-10")), Html::luo_input(array(Attr::classs("form-control"), Attr::id("course_code_text_field"), Attr::type("text"), Attr::value($course_code), Attr::name(Palautuskontrolleri::$kurssitieto_name_tunniste))))) . Html::div(array(Attr::classs("form-group")), Html::luo_label_for("course_desc_text_area", Palautustekstit::description($lang_id), array(Attr::classs("control-label col-sm-2"))) . Html::div(array(Attr::classs("col-sm-10")), Html::luo_textarea($description, array(Attr::classs("form-control"), Attr::id("course_desc_text_area"), Attr::type("text"), Attr::rows(5), Attr::name(Palautuskontrolleri::$kurssitieto_name_kuvaus))))) . Html::div(array(Attr::classs("form-group")), Html::luo_label_for("course_teacher_name_text_field", Palautustekstit::teacher_name($lang_id), array(Attr::classs("control-label col-sm-2"))) . Html::div(array(Attr::classs("col-sm-10")), Html::luo_input(array(Attr::classs("form-control"), Attr::id("course_teacher_name_text_field"), Attr::type("text"), Attr::value($teacher_name), Attr::name(Palautuskontrolleri::$kurssitieto_name_opettaja_nimi))))) . Html::div(array(Attr::classs("form-group")), Html::luo_label_for("course_visibility", Palautustekstit::visibility($lang_id), array(Attr::classs("control-label col-sm-2"))) . Html::div(array(Attr::classs("col-sm-10")), $visibility_dropdown_elem)) . Html::div(array(Attr::classs("form-group")), Html::div(array(Attr::classs("col-sm-2")), "") . Html::div(array(Attr::classs("col-sm-10")), $save_button . $this->create_button_back_to_teacher_view($lang_id))));
     return $html;
 }
示例#2
0
function createtask_GET(Web &$w)
{
    $w->Task->navigation($w, "Create Task");
    // set default dropdowns for these task attributes as empty arrays
    // dropdowns are populated dynamically via JSON based upon task group type selected
    $tasktypes = array();
    $priority = array();
    $members = array();
    // get list of all task groups
    $taskgroups = $w->Task->getTaskGroups();
    // whittle list of task groups down to only those in which i have role appropriate for creating tasks
    if ($taskgroups) {
        foreach ($taskgroups as $tgroup) {
            if ($tgroup->getCanICreate()) {
                $mytaskgroups[] = array($tgroup->title, $tgroup->id);
            }
        }
        if ($w->request(!empty($key) ? $key : null) != "") {
            $t = $w->Task->getTaskGroup($w->request('gid'));
            $tasktypes = $t != "" ? $w->Task->getTaskTypes($t->task_group_type) : array();
            $priority = $t != "" ? $w->Task->getTaskPriority($t->task_group_type) : array();
            $members = $t != "" ? $w->Task->getMembersBeAssigned($t->id) : array();
            sort($members);
            $tasktext = "<table>" . "<tr><td class=section colspan=2>Task Group Description</td></tr>" . "<tr><td><b>Task Group</td><td>" . $t->title . "</td></tr>" . "<tr><td><b>Task Type</b></td><td>" . $t->getTypeTitle() . "</td></tr>" . "<tr><td><b>Description</b></td><td>" . $t->getTypeDescription() . "</td></tr>" . "</table>";
            $w->ctx("tasktext", $tasktext);
        }
        // build form
        $f = Html::form(array(array("Create a New Task - Step One", "section"), array("Task Group", "select", "task_group_id", $w->request('gid'), $mytaskgroups), array("Task Title", "text", "title"), array("Task Type", "select", "task_type", null, $tasktypes), array("Priority", "select", "priority", null, $priority), array("Date Due", "date", "dt_due"), array("Description", "textarea", "description", null, 110, 15), array("Assigned To", "select", "first_assignee_id", null, $members)), $w->localUrl("/task/tasktypeform/"), "POST", " Continue >> ");
        $w->ctx("createtask", $f);
    }
}
示例#3
0
function profile_GET(Web &$w)
{
    $p = $w->pathMatch("box");
    $user = $w->Auth->user();
    $contact = $user->getContact();
    if ($user) {
        $w->ctx("title", "Administration - Profile - " . $user->login);
    } else {
        $w->error("User does not exist.");
    }
    $lines = array();
    $lines[] = array("Change Password", "section");
    $lines[] = array("Password", "password", "password", "");
    $lines[] = array("Repeat Password", "password", "password2", "");
    $lines[] = array("Contact Details", "section");
    $lines[] = array("First Name", "text", "firstname", $contact ? $contact->firstname : "");
    $lines[] = array("Last Name", "text", "lastname", $contact ? $contact->lastname : "");
    $lines[] = array("Communication", "section");
    $lines[] = array("Home Phone", "text", "homephone", $contact ? $contact->homephone : "");
    $lines[] = array("Work Phone", "text", "workphone", $contact ? $contact->workphone : "");
    $lines[] = array("Private Mobile", "text", "priv_mobile", $contact ? $contact->priv_mobile : "");
    $lines[] = array("Work Mobile", "text", "mobile", $contact ? $contact->mobile : "");
    $lines[] = array("Fax", "text", "fax", $contact ? $contact->fax : "");
    $lines[] = array("Email", "text", "email", $contact ? $contact->email : "");
    $lines[] = array("Redirect URL", "text", "redirect_url", $user->redirect_url);
    $f = Html::form($lines, $w->localUrl("/auth/profile"), "POST", "Update");
    if ($p['box']) {
        $w->setLayout(null);
        $f = "<h2>Edit Profile</h2>" . $f;
    }
    $w->out($f);
}
示例#4
0
function tasktypeform_POST(Web $w)
{
    $w->Task->navigation($w, "Create Task");
    // get task type, serialise REQUEST object from step 1 of creating a new task
    $tid = $w->request('task_type');
    $tg = $w->Task->getTaskGroup($w->request('task_group_id'));
    // if no due date given, make 1 month from today
    if ($w->request('dt_due') == "") {
        $_POST['dt_due'] = $w->Task->getNextMonth();
    }
    $req = serialize($_POST);
    // get the additional form fields based on type type
    $theform = array();
    if ($tid != "") {
        $theform = $w->Task->getFormFieldsByTask($tid, $tg);
    }
    if (!$theform) {
        $theform = array(array("Message", "static", "text", "No further information required.<p>Please save your task."));
    }
    // combine input from step one with form fields for step II
    $hiden = array("", "hidden", "formone", $req);
    array_push($theform, $hiden);
    // display the form
    $f = Html::form($theform, $w->localUrl("/task/edit/"), "POST", " Submit ");
    $w->ctx("formfields", $f);
}
示例#5
0
function comment_GET(Web $w)
{
    $p = $w->pathMatch("comment_id", "tablename", "object_id");
    $comment_id = intval($p["comment_id"]);
    $comment = $comment_id > 0 ? $w->Comment->getComment($comment_id) : new Comment($w);
    if ($comment === null) {
        $comment = new Comment($w);
    }
    $help = <<<EOF
//italics//
**bold**
    \t\t
* bullet list
* second item
** subitem
    
# numbered list
# second item
## sub item
    
[[URL|linkname]]
    
== Large Heading
=== Medium Heading
==== Small Heading
    
Horizontal Line:
---
EOF;
    $form = array(array("Comment", "section"), array("", "textarea", "comment", $comment->comment, 100, 15, false), array("Help", "section"), array("", "textarea", "-help", $help, 100, 5, false), array("", "hidden", "redirect_url", $w->request("redirect_url")));
    // return the comment for display and edit
    $w->setLayout(null);
    $w->out(Html::form($form, $w->localUrl("/admin/comment/{$p["comment_id"]}/{$p["tablename"]}/{$p["object_id"]}"), "POST", "Save"));
}
示例#6
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) . "&nbsp;&nbsp;&nbsp;" . 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);
}
示例#7
0
function viewtaskgrouptypes_ALL(Web $w)
{
    $w->Task->navigation($w, "Manage Task Groups");
    History::add("Manage Task Groups");
    $task_groups = $w->Task->getTaskGroups();
    if ($task_groups) {
        usort($task_groups, array("TaskService", "sortbyGroup"));
    }
    // prepare column headings for display
    $line = array(array("Title", "Type", "Description", "Default Assignee"));
    // if task group exists, display title, group type, description, default assignee and button for specific task group info
    if ($task_groups) {
        foreach ($task_groups as $group) {
            $line[] = array(Html::a(WEBROOT . "/task-group/viewmembergroup/" . $group->id, $group->title), $group->getTypeTitle(), $group->description, $group->getDefaultAssigneeName());
        }
    } else {
        // if no groups for this group type, say as much
        $line[] = array("There are no Task Groups Configured. Please create a New Task Group.", "", "", "", "");
    }
    // display list of task groups in the target task group type
    $w->ctx("dashboard", Html::table($line, null, "tablesorter", true));
    // tab: new task group
    // get generic task group permissions
    $arrassign = $w->Task->getTaskGroupPermissions();
    // unset 'ALL' given all can never assign a task
    unset($arrassign[0]);
    // set Is Task Active dropdown
    $is_active = array(array("Yes", "1"), array("No", "0"));
    $grouptypes = $w->Task->getAllTaskGroupTypes();
    // build form to create a new task group within the target group type
    $f = Html::form(array(array("Task Group Attributes", "section"), array("Task Group Type", "select", "task_group_type", null, $grouptypes), array("Title", "text", "title"), array("Who Can Assign", "select", "can_assign", null, $arrassign), array("Who Can View", "select", "can_view", null, $w->Task->getTaskGroupPermissions()), array("Who Can Create", "select", "can_create", null, $w->Task->getTaskGroupPermissions()), array("Active", "select", "is_active", null, $is_active), array("", "hidden", "is_deleted", "0"), array("Description", "textarea", "description", null, "26", "6"), array("Default Assignee", "select", "default_assignee_id", null, $w->Auth->getUsers())), $w->localUrl("/task-group/createtaskgroup"), "POST", "Save");
    // display form
    $w->ctx("creategroup", $f);
}
示例#8
0
function resetpassword_GET(Web $w)
{
    $email = $w->request('email');
    // email
    $token = $w->request('token');
    // token
    $user = $w->Auth->getUserForToken($token);
    //this->getObject("User", array("password_reset_token", $token));
    $validData = false;
    if (!empty($user->id)) {
        // Check that the password reset hasn't expired
        $w->Log->setLogger("AUTH")->debug("USER: "******" TIME: " . time() . " USER_RESET: " . $user->dt_password_reset_at . " RESULT: " . (time() - $user->dt_password_reset_at));
        if (time() - $user->dt_password_reset_at > 86400) {
            $w->msg("Your token has expired (max 24 hours), please submit for a new one", "/auth/forgotpassword");
            return;
        }
        $user_contact = $user->getContact();
        if (!empty($user_contact)) {
            if ($user_contact->email == $email) {
                // We have passed the test
                $password_form = Html::form(array(array("Enter new password", "section"), array("New password", "password", "password"), array("Confirm password", "password", "password_confirm")), $w->localUrl("auth/resetpassword?email={$email}&token={$token}"), "POST", "Reset");
                $w->out($password_form);
                $validData = true;
            }
        }
    }
    if (!$validData) {
        $w->Log->warn("Password reset attempt failed with email: {$email}, token: {$token}");
        $w->out("Invalid email or token, this incident has been logged");
    }
}
示例#9
0
/**
 * Display an edit form for either creating a new
 * record for ExampleData or edit an existing form.
 * 
 * Url:
 * 
 * /kickstart/edit/{id}
 * 
 * @param Web $w
 */
function new_GET(Web $w)
{
    // parse the url into parameters
    $p = $w->pathMatch("id");
    // create the edit form
    $f = Html::form(array(array("New Module", "section"), array("Module Name", "text", "module_name", ""), array("Module Author", "text", "module_author", ""), array("Module Title", "text", "module_title", ""), array("Actions - one per line", "textarea", "actions", "index", null, null, "basic"), array("SQL Structure", "textarea", "sql", "", null, null, "basic")), $w->localUrl("/kickstart/new/" . $p['id']), "POST", " Save");
    // circumvent the template and print straight into the layout
    $w->out($f);
}
示例#10
0
function login_GET(Web $w)
{
    // Check if logged in already
    $user = $w->Auth->user();
    if ($w->Auth->loggedIn() && $w->Auth->allowed($user->redirect_url)) {
        $w->redirect($w->localUrl(!empty($user->redirect_url) ? $user->redirect_url : "/main"));
    }
    $loginform = Html::form(array(array("Application Login", "section"), array("Username", "text", "login"), array("Password", "password", "password")), $w->localUrl("auth/login"), "POST", "Login");
    $w->ctx("loginform", $loginform);
}
示例#11
0
function createreport_ALL(Web &$w)
{
    $w->Report->navigation($w, "Create a Report");
    // build form to create a report. display to users by role is controlled by the template
    // using lookup with type ReportCategory for category listing
    $f = Html::form(array(array("Create a New Report", "section"), array("Title", "text", "title", $w->request('title')), array("Module", "select", "module", $w->request('module'), $w->Report->getModules()), array("Description", "textarea", "description", $w->request('description'), "110", "2"), array("Code", "textarea", "report_code", $w->request('report_code'), "110", "22", false), array("Connection", "select", "report_connection_id", $w->request('report_connection_id'), $w->Report->getConnections())), $w->localUrl("/report/savereport"), "POST", "Save Report");
    $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(" ", "static", "dbfields", "<span id=dbfields></span>")));
    // display form
    $w->ctx("createreport", $f);
    $w->ctx("dbform", $t);
}
示例#12
0
function editmember_GET(Web &$w)
{
    $p = $w->pathMatch("repid", "userid");
    // get member details for edit
    $member = $w->Report->getReportMember($p['repid'], $p['userid']);
    // build editable form for a member allowing change of membership type
    $f = Html::form(array(array("Member Details", "section"), array("", "hidden", "report_id", $p['repid']), array("Name", "static", "name", $w->Report->getUserById($member->user_id)), array("Role", "select", "role", $member->role, $w->Report->getReportPermissions())), $w->localUrl("/report/editmember/" . $p['userid']), "POST", " Update ");
    // display form
    $w->setLayout(null);
    $w->ctx("editmember", $f);
}
示例#13
0
 public function testRetornaClasseAnyComConfiguracaoPadrao()
 {
     Html::config(['input' => ['class' => 'form-input'], 'form' => ['class' => "form-horizontal"]]);
     $username = Html::input(['attributes' => ['type' => 'text', 'name' => 'username']]);
     $password = Html::input(['attributes' => ['type' => 'password', 'name' => 'password']]);
     $form = Html::form(['attributes' => ['action' => 'save.php'], 'content' => $username . PHP_EOL . $password]);
     $expected = '<form action="save.php" class="form-horizontal">';
     $expected .= '<input type="text" name="username" class="form-input"/>' . PHP_EOL;
     $expected .= '<input type="password" name="password" class="form-input"/>';
     $expected .= '</form>';
     $this->assertEquals($expected, (string) $form);
 }
示例#14
0
function editlookup_GET(Web &$w)
{
    $p = $w->pathMatch("id", "type");
    $lookup = $w->Admin->getLookupbyId($p['id']);
    if ($lookup) {
        $types = $w->Admin->getLookupTypes();
        $f = Html::form(array(array("Edit an Existing Entry", "section"), array("Type", "select", "type", $lookup->type, $types), array("Key", "text", "code", $lookup->code), array("Value", "text", "title", $lookup->title)), $w->localUrl("/admin/editlookup/" . $lookup->id . "/" . $p['type']), "POST", " Update ");
        $w->setLayout(null);
        $w->out($f);
    } else {
        $w->msg("No such Lookup Item?", "/admin/lookup/");
    }
}
示例#15
0
/**
 * Display an edit form for either creating a new
 * record for ExampleData or edit an existing form.
 * 
 * Url:
 * 
 * /example/edit/{id}
 * 
 * @param Web $w
 */
function edit_GET(Web $w)
{
    // parse the url into parameters
    $p = $w->pathMatch("id");
    // create either a new or existing object
    if (isset($p['id'])) {
        $data = $w->Example->getDataForId($p['id']);
    } else {
        $data = new ExampleData($w);
    }
    // create the edit form
    $f = Html::form(array(array("Edit Example Data", "section"), array("Title", "text", "title", $data->title), array("Data", "text", "data", $data->data)), $w->localUrl("/example/edit/" . $p['id']), "POST", " Save ");
    // circumvent the template and print straight into the layout
    $w->out($f);
}
function ajaxGetTaskTypeFormFields_GET($w)
{
    $tid = $w->request('task_type');
    $tg = $w->Task->getTaskGroup($w->request('task_group_id'));
    if (empty($tid) or empty($tg)) {
        return;
    }
    $form_fields = array();
    if (!empty($tid)) {
        $form_fields = $w->Task->getFormFieldsByTask($tid, $tg);
        if (!empty($form_fields)) {
            echo Html::form($form_fields, "/task/edit", "POST", "Save", "form_fields_form");
        }
    }
}
示例#17
0
function deletemember_GET(Web &$w)
{
    $p = $w->pathMatch("report_id", "user_id");
    // get details of member to be deleted
    $member = $w->Report->getReportMember($p['report_id'], $p['user_id']);
    if ($member) {
        // build a static form displaying members details for confirmation of delete
        $f = Html::form(array(array("Confirm Delete Member", "section"), array("", "hidden", "is_deleted", "1"), array("Name", "static", "name", $w->Report->getUserById($member->user_id))), $w->localUrl("/report/deletemember/" . $member->report_id . "/" . $member->user_id), "POST", " Delete ");
    } else {
        $f = "No such member?";
    }
    // display form
    $w->setLayout(null);
    $w->ctx("deletemember", $f);
}
示例#18
0
 /**
  * Displays a form for editing a current language.
  *
  * Route: admin/multilanguage/languages/edit/:num
  *
  * @param int $id The id of the language to edit.
  */
 public static function edit($id)
 {
     if (!($lang = Multilanguage::language()->find($id))) {
         return ERROR_404;
     }
     if (isset($_POST['update_language']) && Html::form()->validate()) {
         $status = Multilanguage::language()->where('id', '=', $id)->update(array('name' => $_POST['name'], 'code' => $_POST['code']));
         if ($status) {
             Message::ok('Language updated successfully.');
         } else {
             Message::error('Error updating language, please try again.');
         }
     }
     $form[] = array('fields' => array('name' => array('title' => 'Language Name <em>(Ex: Russian)</em>', 'type' => 'text', 'validate' => array('required'), 'default_value' => $lang->name), 'code' => array('title' => '2 Letter Language Code <em>(Ex: ru)<em>', 'type' => 'text', 'validate' => array('required', 'min:2'), 'attributes' => array('maxlength' => 2), 'default_value' => $lang->code), 'update_language' => array('type' => 'submit', 'value' => 'Update Language')));
     return array('title' => 'Edit Language', 'content' => Html::form()->build($form));
 }
示例#19
0
function createfeed_GET(Web &$w)
{
    $w->Report->navigation($w, "Create a Feed");
    // get list of reports for logged in user. sort to list unapproved reports first
    $reports = $w->Report->getReportsbyUserId($w->session('user_id'));
    // if i am a member of a list of reports, lets display them
    if ($reports && ($w->Auth->user()->hasRole("report_editor") || $w->Auth->user()->hasRole("report_admin"))) {
        foreach ($reports as $report) {
            // get report data
            $rep = $w->Report->getReportInfo($report->report_id);
            $myrep[] = array($rep->title, $rep->id);
        }
    }
    $f = Html::form(array(array("Create a Feed from a Report", "section"), array("Select Report", "select", "rid", null, $myrep), array("Feed Title", "text", "title"), array("Description", "textarea", "description", null, "40", "6")), $w->localUrl("/report/createfeed"), "POST", "Save");
    $w->ctx("createfeed", $f);
}
示例#20
0
function addmembers_GET(Web &$w)
{
    $p = $w->pathMatch("id");
    // get the list of report editors and admins
    $members1 = $w->Auth->getUsersForRole("report_editor");
    $members2 = $w->Auth->getUsersForRole("report_user");
    // merge into single array
    $members12 = array_merge($members1, $members2);
    // strip the dumplicates. dealing with an object so no quick solution
    $members = array();
    foreach ($members12 as $member) {
        if (!in_array($member, $members)) {
            $members[] = $member;
        }
    }
    // build form
    $addUserForm = array(array("", "hidden", "report_id", $p['id']), array("Add Member", "select", "member", null, $members), array("With Role", "select", "role", "", $w->Report->getReportPermissions()));
    $w->setLayout(null);
    $w->ctx("addmembers", Html::form($addUserForm, $w->localUrl("/report/updatemembers/"), "POST", " Submit "));
}
示例#21
0
function editfeed_GET(Web &$w)
{
    $w->Report->navigation($w, "Edit Feed");
    $p = $w->pathMatch("id");
    $feed = $w->Report->getFeedInfobyId($p["id"]);
    // get list of reports for logged in user. sort to list unapproved reports first
    $reports = $w->Report->getReportsbyUserId($w->session('user_id'));
    // if i am a member of a list of reports, lets display them
    if ($reports && ($w->Auth->user()->hasRole("report_editor") || $w->Auth->user()->hasRole("report_admin"))) {
        foreach ($reports as $report) {
            // get report data
            $rep = $w->Report->getReportInfo($report->report_id);
            $myrep[] = array($rep->title, $rep->id);
        }
    }
    $note = "Available Formats: html, csv, pdf, xml<br>";
    $note .= "Date Formats must be <b>d/m/Y</b> to mimic date picker";
    $f = Html::form(array(array("Create a Feed from a Report", "section"), array("Select Report", "select", "rid", $feed->report_id, $myrep), array("Feed Title", "text", "title", $feed->title), array("Description", "textarea", "description", $feed->description, "40", "6"), array("Feed URL", "static", "url", $feed->url), array("Note", "static", "url", $note)), $w->localUrl("/report/editfeed/" . $feed->id), "POST", " Update ");
    $w->ctx("editfeed", $f);
}
示例#22
0
function ajaxGetFieldForm_ALL(Web $w)
{
    $p = $w->pathMatch("task_type", "task_group_id", "task_id");
    if (empty($p['task_group_id']) || empty($p['task_type'])) {
        return;
    }
    $task_type = $w->Task->getTaskTypeObject($p['task_type']);
    if (empty($task_type)) {
        return;
    }
    $task_group = $w->Task->getTaskgroup($p['task_group_id']);
    if (empty($task_group->id)) {
        return;
    }
    $task = null;
    if (!empty($p['task_id'])) {
        $task = $w->Task->getTask($p['task_id']);
    }
    $w->out(json_encode(array(Html::form($task_type->getFieldFormArray($task_group, $task), "/task/edit", null, null, "form_fields_form"))));
}
示例#23
0
function runreport_ALL(Web &$w)
{
    $w->Report->navigation($w, "Generate Report");
    $p = $w->pathMatch("id");
    // if there is a report ID in the URL ...
    if (!empty($p['id'])) {
        // get member
        $member = $w->Report->getReportMember($p['id'], $w->session('user_id'));
        // get the relevant report
        $rep = $w->Report->getReportInfo($p['id']);
        // if report exists, first check status and user role before displaying
        if (!empty($rep)) {
            if ($rep->is_approved == "0" && $member->role != "EDITOR" && !$w->Auth->user()->hasRole("report_admin")) {
                $w->msg($rep->title . ": Report is yet to be approved", "/report/index/");
            } else {
                // display form
                $w->Report->navigation($w, $rep->title);
                if (!empty($member->role) && $member->role == "EDITOR" || $w->Auth->hasRole("report_admin")) {
                    $btnedit = Html::b("/report/viewreport/" . $rep->id, " Edit Report ");
                } else {
                    $btnedit = "";
                }
                // get the form array
                $form = $rep->getReportCriteria();
                // if there is a form display it, otherwise say as much
                if ($form) {
                    $theform = Html::form($form, $w->localUrl("/report/exereport/" . $rep->id), "POST", " Display Report ");
                } else {
                    $theform = "No search criteria?";
                }
                // display
                $w->ctx("btnedit", $btnedit);
                $w->ctx("report", $theform);
            }
        }
    }
}
示例#24
0
        
    });

</script>
<div id="tester"></div>
<div class="widget">
    <div class="whead"><h6><?php 
echo $this->pageName;
?>
</h6>

        <?php 
//if ($model->search(array('scope' => 'ordersMade'))->totalItemCount) {
?>
        <?php 
echo Html::form('/admin/cart/history/', 'GET', array('id' => 'filter_form', 'class' => 'floatR'));
?>
        <div class="row-form">

            <?php 
echo Html::activeLabelEx($form, 'from_date');
?>

            <?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => CHtml::activeName($form, 'from_date'), 'value' => $form->from_date, 'options' => array('dateFormat' => "yy-mm-dd")));
?>
</div>

        <div class="row-form">
            <?php 
echo CHtml::activeLabelEx($form, 'to_date');
示例#25
0
function updateusergroupnotify_GET(Web &$w)
{
    $p = $w->pathMatch("id");
    // get task title
    $title = $w->Task->getTaskGroupTitleById($p['id']);
    // get member
    $member = $w->Task->getMemberGroupById($p['id'], $_SESSION['user_id']);
    // get user notify settings for Task Group
    $notify = $w->Task->getTaskGroupUserNotify($_SESSION['user_id'], $p['id']);
    if ($notify) {
        foreach ($notify as $n) {
            $v[$n->role][$n->type] = $n->value;
            $task_creation = $n->task_creation;
            $task_details = $n->task_details;
            $task_comments = $n->task_comments;
            $time_log = $n->time_log;
            $task_documents = $n->task_documents;
            $task_pages = $n->task_pages;
        }
    } else {
        $notify = $w->Task->getTaskGroupNotify($p['id']);
        if ($notify) {
            foreach ($notify as $n) {
                $v[$n->role][$n->type] = $n->value;
                $task_creation = 1;
                $task_details = 1;
                $task_comments = 1;
                $time_log = 1;
                $task_documents = 1;
                $task_pages = 1;
            }
        }
    }
    // if no user notifications and no group defaults
    // set blank form - all task events on - so user can create their user notifications
    if (!$v) {
        $v['guest']['creator'] = 0;
        $v['member']['creator'] = 0;
        $v['member']['assignee'] = 0;
        $v['owner']['creator'] = 0;
        $v['owner']['assignee'] = 0;
        $v['owner']['other'] = 0;
        $task_creation = 1;
        $task_details = 1;
        $task_comments = 1;
        $time_log = 1;
        $task_documents = 1;
        $task_pages = 1;
    }
    $f = array(array($title . " - Notifications", "section"));
    // so foreach role/type lets get the values and create  checkboxes
    foreach ($v as $role => $types) {
        if ($role == strtolower($member->role)) {
            foreach ($types as $type => $value) {
                $f[] = array(ucfirst($type), "checkbox", $role . "_" . $type, $value);
            }
        }
    }
    // add Task Events to form
    $f[] = array("For which events should you receive Notification?", "section");
    $f[] = array("Task Creation", "checkbox", "task_creation", $task_creation);
    $f[] = array("Task Details Update", "checkbox", "task_details", $task_details);
    $f[] = array("Comments Added", "checkbox", "task_comments", $task_comments);
    $f[] = array("Time Log Entry", "checkbox", "time_log", $time_log);
    $f[] = array("Documents Added", "checkbox", "task_documents", $task_documents);
    $f[] = array("Pages Added", "checkbox", "task_pages", $task_pages);
    $f = Html::form($f, $w->localUrl("/task/updateusergroupnotify/" . $p['id']), "POST", "Save");
    $w->setLayout(null);
    $w->out($f);
}
示例#26
0
                    <?php 
if (Yii::app()->hasModule('discounts')) {
    if ($model->appliedDiscount) {
        echo '<span class="price-strike">' . $model->toCurrentCurrency('originalPrice') . '</span>';
    }
}
?>
                    <?php 
$this->widget('ext.admin.frontControl.FrontControlWidget', array('data' => $model));
?>


                    <div class="product-view-action">
                        <?php 
if (Yii::app()->hasModule('cart')) {
    echo Html::form(array('/cart/add'), 'post', array('id' => 'form-add-cart-' . $model->id, 'class' => ' form-horizontal'));
    echo Html::hiddenField('product_id', $model->id);
    echo Html::hiddenField('product_price', $model->price);
    echo Html::hiddenField('use_configurations', $model->use_configurations);
    echo Html::hiddenField('currency_rate', Yii::app()->currency->active->rate);
    echo Html::hiddenField('currency_id', $model->currency_id);
    echo Html::hiddenField('supplier_id', $model->supplier_id);
    echo Html::hiddenField('pcs', $model->pcs);
    echo Html::hiddenField('configurable_id', 0);
    ?>
                            <div class="row">
                                <div class="col-xs-12">



示例#27
0
<?php

echo Html::form($this->createUrl('/users/login'), 'post', array('id' => 'user-login-form', 'class' => 'form'));
if ($model->hasErrors()) {
    Yii::app()->tpl->alert('danger', Html::errorSummary($model));
}
?>
<div class="input-group">
    <span class="input-group-addon">
        <span class="fa fa-user"></span>
    </span>
    <?php 
echo Html::activeTextField($model, 'login', array('class' => 'form-control', 'placeholder' => $model->getAttributeLabel('login')));
?>
</div>
<br/>
<div class="input-group">
    <span class="input-group-addon">
        <span class="fa fa-key"></span>
    </span>
    <?php 
echo Html::activePasswordField($model, 'password', array('class' => 'form-control', 'placeholder' => $model->getAttributeLabel('password')));
?>
</div>

<br/>
<div class="input-group">
    <?php 
echo Html::activeCheckBox($model, 'rememberMe', array('class' => 'form-control2'));
?>
    <?php 
示例#28
0
            }
            $parent_message = $w->Inbox->getMessage($parent_id);
            print "<div style='padding:3px; background-color: " . $bgcolor . "';'> Message sent by: <i>" . $w->Auth->getUser($parent_message->sender_id)->getFullname() . "</i>  on: <i>" . $parent_message->getDate("dt_created", "d/m/Y H:i") . "</i><br/>";
            print $parent_message->getMessage();
            print "</div>";
            $parent_id = $parent_message->parent_message_id ? $parent_message->parent_message_id : null;
            $counter++;
        }
        print "</div>";
    }
    //	print_r($message);
    $lines = array(array("", "section"), array("To", "autocomplete", "receiver_id", $message->user_id, $w->Auth->getUsers()), array("Subject", "text", "subject", $message->subject), array("", "section"), array("", "textarea", "message", null, 120, 10));
    print Html::form($lines, WEBROOT . "/inbox/send/" . $messageid, "POST", "Send");
    if ($message_arr) {
        foreach ($message_arr as $mes) {
            print_r($mes);
        }
    }
} else {
    $lines = array(array("Send a Message", "section"), array("To", "autocomplete", "receiver_id", null, $w->Auth->getUsers()), array("Subject", "text", "subject"), array("", "textarea", "message", null, 120, 10));
    print Html::form($lines, WEBROOT . "/inbox/send", "POST", "Send");
}
?>
<script type='text/javascript'>
    
    CKEDITOR.replace( 'message' ,
    {
        toolbar : 'Basic'
    });
</script>
?>
        <?php 
echo '<strong> ' . $lastUpdatedBefore . '</strong>';
?>
        <?php 
echo Yii::t('ReputationModule.views_adminReputation_show', ' minutes ago');
?>
        <?php 
echo '<br><br>';
?>
        <?php 
echo Yii::t('ReputationModule.views_adminReputation_show', 'In the area below, you see how much reputation each member inside this space has gained.');
?>
        <br/><br/>
        <?php 
echo Html::form($this->createUrl('//reputation/adminReputation/show', array('sguid' => $space->guid)), 'post');
?>

        <table class="table table-hover">
            <thead>
            <tr>
                <th><?php 
echo Yii::t('ReputationModule.views_adminReputation_show', "User");
?>
</th>
                <th></th>
                <th style="text-align: center"><?php 
echo Yii::t('ReputationModule.views_adminReputation_show', "Score");
?>
                    <i class="fa fa-info-circle tt" data-toggle="tooltip" data-placement="top"
                       title="<?php 
示例#30
0
    <img src="<?php 
echo Yii::app()->user->avatarPath;
?>
" alt="<?php 
echo Yii::t('core', 'CHECKUSER', 0);
?>
">
    <br/>
    <?php 
echo Yii::t('default', 'HELLO', array('{username}' => Yii::t('core', 'CHECKUSER', 0)));
?>
</div>
<br/>

<?php 
echo Html::form('', 'post', array('id' => 'userblock-login-form', 'class' => 'form'));
if ($model->hasErrors()) {
    Yii::app()->tpl->alert('danger', Html::errorSummary($model));
}
?>
<div class="input-group input-group">
    <span class="input-group-addon">
        <span class="icon-user"></span>
    </span>
    <?php 
echo Html::activeTextField($model, 'login', array('class' => 'form-control', 'placeholder' => $model->getAttributeLabel('login')));
?>
</div>
<br/>
<div class="input-group input-group">
    <span class="input-group-addon">