Beispiel #1
0
/**
 * Функция формирует глобальный массив $mod с элементами:
 * <pre>
 *      tpl_dir      путь к папке с шаблонами модуля
 *      theme_folder имя папки с файлами дизайна
 *      config_vars  массив с языковыми переменными модуля
 * </pre>
 * Формирует и передаёт в шаблонизатор:
 * <pre>
 *      $tpl_dir     путь к папке с шаблонами модуля
 *      $mod_dir     имя папки с модулями
 *      $config_vars массив с языковыми переменными модуля
 * </pre>
 * Регистрирует в шаблонизаторе функцию in_array
 *
 * @param string $modulepath имя папки модуля
 * @param string $lang_section секция языкового файла
 */
function set_modul_globals($modulepath, $lang_section = false)
{
    global $mod, $AVE_Template;
    $tpl_dir = BASE_DIR . '/modules/' . $modulepath . '/templates/';
    $lang_file = BASE_DIR . '/modules/' . $modulepath . '/lang/' . $_SESSION['user_language'] . '.txt';
    if (!file_exists($lang_file)) {
        $lang_file = BASE_DIR . '/modules/' . $modulepath . '/lang/ru.txt';
    }
    if (!file_exists($lang_file)) {
        display_notice('Ошибка! Отсутствует языковой файл. Пожалуйста, проверьте язык, установленный по умолчанию, в файле ' . ABS_PATH . 'inc/config.php');
        exit;
    }
    if ($lang_section === false) {
        $AVE_Template->config_load($lang_file);
    } else {
        $AVE_Template->config_load($lang_file, $lang_section);
    }
    $config_vars = $AVE_Template->get_config_vars();
    $AVE_Template->assign('tpl_dir', $tpl_dir);
    $AVE_Template->assign('mod_dir', BASE_DIR . '/modules');
    $AVE_Template->assign('config_vars', $config_vars);
    $mod['tpl_dir'] = $tpl_dir;
    $mod['theme_folder'] = defined('THEME_FOLDER') ? THEME_FOLDER : DEFAULT_THEME_FOLDER;
    $mod['config_vars'] = $config_vars;
    $AVE_Template->register_function('in_array', 'in_array');
}
Beispiel #2
0
function sess_open($save_path, $session_name)
{
    global $sess_dblink;
    @(require BASE_DIR . '/inc/db.config.php');
    if (!defined('PREFIX')) {
        define('PREFIX', $config['dbpref']);
    }
    if (!($sess_dblink = @mysql_connect($config['dbhost'], $config['dbuser'], $config['dbpass']))) {
        display_notice("Error connect MySQL database.");
        die;
    }
    if (!@mysql_select_db($config['dbname'], $sess_dblink)) {
        display_notice("Error select MySQL database.");
        die;
    }
    @mysql_query("SET NAMES 'utf-8'", $sess_dblink);
    return true;
}
Beispiel #3
0
 /**
  * Creates tables for the module implementing the class.
  * If you override this function make sure that your code can handles table creation.
  *
  */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->dbManager->createTable($this);
             if ($this->bean_implements('ACL')) {
                 if (!empty($this->acltype)) {
                     ACLAction::addActions($this->getACLCategory(), $this->acltype);
                 } else {
                     ACLAction::addActions($this->getACLCategory());
                 }
             }
         } else {
             echo "Table already exists : {$this->table_name}<br>";
         }
         if ($this->is_AuditEnabled()) {
             if (!$this->db->tableExists($this->get_audit_table_name())) {
                 $this->create_audit_table();
             }
         }
     }
 }
function errNoCats_MetaDataTable()
{
    return display_notice("There are currently no Meta Data Categories applicable to this user.");
}
                        $course_community = $db->GetOne($query);
                        if ($course_community) {
                            $syllabi = glob(ENTRADA_ABSOLUTE . "/core/storage/syllabi/" . $course["course_code"] . "-syllabus-" . ($year != 0 ? $year : date("Y", time())) . "*");
                            if ($syllabi) {
                                $syllabus_month = 0;
                                foreach ($syllabi as $syllabus) {
                                    $month = substr($syllabus, strrpos($syllabus, "-") + 1, strlen($syllabus));
                                    $month = substr($month, 0, strrpos($month, ".pdf"));
                                    if ($month > $syllabus_month) {
                                        $syllabus_month = $month;
                                    }
                                }
                            }
                            $file_realpath = ENTRADA_ABSOLUTE . "/core/storage/syllabi/" . $course["course_code"] . "-syllabus-" . ($year != 0 ? $year : date("Y", time())) . "-" . $syllabus_month . ".pdf";
                            if (file_exists($file_realpath)) {
                                $syllabi[$course["course_code"]] = array("url" => ENTRADA_URL . "/community" . $course_community . "?id=" . $course["course_id"] . "&method=serve-syllabus&course_code=" . $course["course_code"] . "&month=" . $syllabus_month);
                            }
                        }
                        echo "<li><a href=\"" . ENTRADA_URL . "/courses?id=" . $course["course_id"] . "\">" . html_encode($course["course_code"] . ": " . $course["course_name"]) . "</a>" . (isset($syllabi[$course["course_code"]]) ? " <a href=\"" . $syllabi[$course["course_code"]]["url"] . "\" title=\"Download Syllabus\"><i class=\"icon-file\"></i></a>" : "") . "</li>\n";
                    }
                    echo "\t</ul>\n";
                    echo "</li>\n";
                }
            }
            echo "</ol>\n";
        }
        if (!$course_flag) {
            echo display_notice(array("There are no courses to display."));
        }
    }
}
                            $template_html = fetch_template("global/external");
                            if ($template_html) {
                                echo str_replace(array("%DEFAULT_CHARSET%", "%ENTRADA_URL%", "%TITLE%", "%BODY%"), array(DEFAULT_CHARSET, ENTRADA_URL, $TITLE, $BODY), $template_html);
                            }
                            exit;
                        }
                    }
                }
            } else {
                $TITLE = "Not Authorized";
                $BODY = display_notice(array("The file that you are trying to access is only accessible by authorized users."));
                $template_html = fetch_template("global/external");
                if ($template_html) {
                    echo str_replace(array("%DEFAULT_CHARSET%", "%ENTRADA_URL%", "%TITLE%", "%BODY%"), array(DEFAULT_CHARSET, ENTRADA_URL, $TITLE, $BODY), $template_html);
                }
                exit;
            }
        } else {
            $TITLE = "Not Found";
            $BODY = display_notice(array("The file you are trying to download does not exist in our system. This file may have been removed by the course director or system administrator or the file identifier may have been mistyped in the URL."));
            $template_html = fetch_template("global/external");
            if ($template_html) {
                echo str_replace(array("%DEFAULT_CHARSET%", "%ENTRADA_URL%", "%TITLE%", "%BODY%"), array(DEFAULT_CHARSET, ENTRADA_URL, $TITLE, $BODY), $template_html);
            }
            exit;
        }
    } else {
        header("Location: " . ENTRADA_URL);
        exit;
    }
}
Beispiel #7
0
                            ?>
									</tbody>
								</table>
							</form>
						<?php 
                        }
                    }
                    break;
                case 'delete':
                default:
                    echo "<h1>De/Activate or Delete Groups</h1>";
                    $total_groups = count($GROUP_IDS);
                    $query = "\tSELECT * FROM `course_groups`\n\t\t\t\t\t\t\t\t\t\tWHERE `cgroup_id` IN (" . implode(", ", $GROUP_IDS) . ")\n\t\t\t\t\t\t\t\t\t\tORDER BY `group_name` ASC";
                    $results = $db->GetAll($query);
                    if ($results) {
                        echo display_notice(array("Please review the following group" . ($total_groups != 1 ? "s" : "") . " to ensure that you wish to activate, deactivate or <strong>permanently delete</strong> " . ($total_groups != 1 ? "them" : "it") . ".<br /><br />Deleting will also remove any group members and this action cannot be undone."));
                        ?>
								<form action="<?php 
                        echo ENTRADA_URL;
                        ?>
/admin/courses/groups?section=edit&amp;action=delete&amp;step=2&amp;id=<?php 
                        echo $COURSE_ID;
                        ?>
&amp;gid=<?php 
                        echo $GROUP_ID;
                        ?>
" method="post">
									<input type="hidden" name="gid" value="<?php 
                        echo $GROUP_ID;
                        ?>
" />
if ($ACTION == "login" && $ERROR) {
    echo display_error();
}
/**
 * If the user is trying to access a link and is not logged in, display a
 * notice to inform the user that they need to log in first.
 */
if ($PROCEED_TO && (stristr($PROCEED_TO, "link-course.php") || stristr($PROCEED_TO, "link-event.php"))) {
    echo display_notice("You must log in to access this link; once you have logged in you will be automatically redirected to the requested location.");
}
/**
 * If the user is trying to access a file and is not logged in, display a
 * notice to inform the user that they need to log in first.
 */
if ($PROCEED_TO && (stristr($PROCEED_TO, "file-course.php") || stristr($PROCEED_TO, "file-event.php"))) {
    echo display_notice("You must log in to download the requested file; once you have logged in the download will start automatically.");
}
?>
<div class="row-fluid">
	<div class="span6">
		<h2><?php 
echo APPLICATION_NAME;
?>
 Login</h2>
		<p>Please enter your <?php 
echo APPLICATION_NAME;
?>
 username and password to log in.</p>

		<form class="form-horizontal login-form" action="<?php 
echo ENTRADA_URL;
    public static function getTargetControls($target_data, $options_for = "", $form_id = 0)
    {
        global $ENTRADA_USER, $ENTRADA_ACL, $db, $use_ajax;
        if ($form_id) {
            $query = "\tSELECT b.*\n\t\t\t\t\t\tFROM `evaluation_forms` AS a\n\t\t\t\t\t\tLEFT JOIN `evaluations_lu_targets` AS b\n\t\t\t\t\t\tON b.`target_id` = a.`target_id`\n\t\t\t\t\t\tWHERE a.`form_active` = '1'\n\t\t\t\t\t\tAND b.`target_active` = '1'\n\t\t\t\t\t\tAND a.`eform_id` = " . $db->qstr($form_id);
            $target_details = $db->GetRow($query);
            if ($target_details) {
                switch ($target_details["target_shortname"]) {
                    case "course":
                        $courses_list = array();
                        $query = "\tSELECT `course_id`, `organisation_id`, `course_code`, `course_name`\n\t\t\t\t\t\t\t\t\tFROM `courses`\n\t\t\t\t\t\t\t\t\tWHERE `organisation_id`=" . $ENTRADA_USER->getActiveOrganisation() . "\n\t\t\t\t\t\t\t\t\tAND `course_active` = '1'\n\t\t\t\t\t\t\t\t\tORDER BY `course_code` ASC, `course_name` ASC";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                if ($ENTRADA_ACL->amIAllowed(new CourseResource($result["course_id"], $result["organisation_id"]), "read")) {
                                    $courses_list[$result["course_id"]] = $result["course_code"] . " - " . $result["course_name"];
                                }
                            }
                        }
                        ?>
						<tr>
							<td></td>
							<td style="vertical-align: top">
								<label for="PickList" class="form-required">Select Courses</label>
								<div class="content-small"><strong>Hint:</strong> Select the course or courses you would like to have evaluated.</div>
							</td>
							<td style="vertical-align: top">
								<select class="multi-picklist" id="PickList" name="course_ids[]" multiple="multiple" size="4" style="width: 100%; margin-bottom: 5px">
								<?php 
                        if (is_array($target_data["evaluation_targets"]) && !empty($target_data["evaluation_targets"])) {
                            foreach ($target_data["evaluation_targets"] as $target) {
                                echo "<option value=\"" . (int) $target["target_value"] . "\">" . html_encode($courses_list[$target["target_value"]]) . "</option>\n";
                            }
                        }
                        ?>
								</select>
								<div style="float: left; display: inline">
									<input type="button" id="courses_list_state_btn" class="btn" value="Show List" onclick="toggle_list('courses_list')" />
								</div>
								<div style="float: right; display: inline">
									<input type="button" id="courses_list_remove_btn" class="btn btn-danger" onclick="delIt()" value="Remove" />
									<input type="button" id="courses_list_add_btn" class="btn btn-success" onclick="addIt()" style="display: none" value="Add" />
								</div>
								<div id="courses_list" style="clear: both; padding-top: 3px; display: none">
									<h2>Course List</h2>
									<select class="multi-picklist" id="SelectList" name="other_courses_list" multiple="multiple" size="15" style="width: 100%">
									<?php 
                        foreach ($courses_list as $course_id => $course_name) {
                            if (!in_array($course_id, $target_data["evaluation_targets"])) {
                                echo "<option value=\"" . (int) $course_id . "\">" . html_encode($course_name) . "</option>\n";
                            }
                        }
                        ?>
									</select>
								</div>
							</td>
						</tr>
						<?php 
                        break;
                    case "teacher":
                        $teachers_list = array();
                        $query = "\tSELECT a.`id` AS `proxy_id`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\tLEFT JOIN `event_contacts` AS c\n\t\t\t\t\t\t\t\t\tON c.`proxy_id` = a.`id`\n\t\t\t\t\t\t\t\t\tLEFT JOIN `events` AS d\n\t\t\t\t\t\t\t\t\tON d.`event_id` = c.`event_id`\n\t\t\t\t\t\t\t\t\tWHERE b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\tAND (b.`group` = 'faculty' OR\n\t\t\t\t\t\t\t\t\t\t(b.`group` = 'resident' AND b.`role` = 'lecturer')\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tAND d.`event_finish` >= " . $db->qstr(strtotime("-12 months")) . "\n\t\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\t\tORDER BY a.`lastname` ASC, a.`firstname` ASC";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                $teachers_list[$result["proxy_id"]] = $result["fullname"];
                            }
                        }
                        $target_ids = array();
                        foreach ($target_data["evaluation_targets"] as $temp_target) {
                            if ($temp_target["target_type"] == "proxy_id") {
                                $target_ids[] = $temp_target["target_value"];
                            }
                        }
                        ?>
						<tr>
							<td></td>
							<td style="vertical-align: top">
								<label for="PickList" class="form-required">Select Teachers</label>
								<div class="content-small"><strong>Hint:</strong> Select the teacher or teachers you would like to have evaluated.</div>
							</td>
							<td style="vertical-align: top">
								<select class="multi-picklist" id="PickList" name="teacher_ids[]" multiple="multiple" size="4" style="width: 100%; margin-bottom: 5px">
								<?php 
                        if (is_array($target_data["evaluation_targets"]) && !empty($target_data["evaluation_targets"])) {
                            foreach ($teachers_list as $proxy_id => $teacher_name) {
                                if (in_array($proxy_id, $target_ids)) {
                                    echo "<option value=\"" . (int) $proxy_id . "\">" . html_encode($teacher_name) . "</option>\n";
                                }
                            }
                        }
                        ?>
								</select>
								<div style="float: left; display: inline">
									<input type="button" id="teachers_list_state_btn" class="btn" value="Show List" onclick="toggle_list('teachers_list')" />
								</div>
								<div style="float: right; display: inline">
									<input type="button" id="teachers_list_remove_btn" class="btn btn-danger" onclick="delIt()" value="Remove" />
									<input type="button" id="teachers_list_add_btn" class="btn btn-success" onclick="addIt()" style="display: none" value="Add" />
								</div>
								<div id="teachers_list" style="clear: both; padding-top: 3px; display: none">
									<h2>Course List</h2>
									<select class="multi-picklist" id="SelectList" name="other_teachers_list" multiple="multiple" size="15" style="width: 100%">
									<?php 
                        foreach ($teachers_list as $proxy_id => $teacher_name) {
                            if (!isset($target_data["evaluation_targets"]) || !is_array($target_data["evaluation_targets"]) || !in_array($proxy_id, $target_data["evaluation_targets"])) {
                                echo "<option value=\"" . (int) $proxy_id . "\">" . html_encode($teacher_name) . "</option>\n";
                            }
                        }
                        ?>
									</select>
								</div>
							</td>
						</tr>
						<?php 
                        break;
                    case "resident":
                        $residents_list = array();
                        $query = "\tSELECT a.`id` AS `proxy_id`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\tWHERE b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\tAND b.`group` = 'student'\n\t\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\t\tORDER BY a.`lastname` ASC, a.`firstname` ASC";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                $residents_list[$result["proxy_id"]] = $result["fullname"];
                            }
                        }
                        $target_ids = array();
                        if (isset($target_data["evaluation_targets"]) && @count($target_data["evaluation_targets"])) {
                            foreach ($target_data["evaluation_targets"] as $temp_target) {
                                if ($temp_target["target_type"] == "proxy_id") {
                                    $target_ids[] = $temp_target["target_value"];
                                }
                            }
                        }
                        ?>
						<tr>
							<td></td>
							<td style="vertical-align: top">
								<label for="PickList" class="form-required">Select Learners</label>
								<div class="content-small"><strong>Hint:</strong> Select the learner(s) you would like to have evaluated.</div>
							</td>
							<td style="vertical-align: top">
								<select class="multi-picklist" id="PickList" name="resident_ids[]" multiple="multiple" size="4" style="width: 100%; margin-bottom: 5px">
								<?php 
                        if (is_array($target_data["evaluation_targets"]) && !empty($target_data["evaluation_targets"])) {
                            foreach ($residents_list as $proxy_id => $resident_name) {
                                if (in_array($proxy_id, $target_ids)) {
                                    echo "<option value=\"" . (int) $proxy_id . "\">" . html_encode($resident_name) . "</option>\n";
                                }
                            }
                        }
                        ?>
								</select>
								<div style="float: left; display: inline">
									<input type="button" id="residents_list_state_btn" class="btn" value="Show List" onclick="toggle_list('residents_list')" />
								</div>
								<div style="float: right; display: inline">
									<input type="button" id="residents_list_remove_btn" class="btn btn-danger" onclick="delIt()" value="Remove" />
									<input type="button" id="residents_list_add_btn" class="btn btn-success" onclick="addIt()" style="display: none" value="Add" />
								</div>
								<div id="residents_list" style="clear: both; padding-top: 3px; display: none">
									<h2>Learner List</h2>
									<select class="multi-picklist" id="SelectList" name="other_residents_list" multiple="multiple" size="15" style="width: 100%">
									<?php 
                        foreach ($residents_list as $proxy_id => $resident_name) {
                            if (!isset($target_data["evaluation_targets"]) || !is_array($target_data["evaluation_targets"]) || !in_array($proxy_id, $target_data["evaluation_targets"])) {
                                echo "<option value=\"" . (int) $proxy_id . "\">" . html_encode($resident_name) . "</option>\n";
                            }
                        }
                        ?>
									</select>
								</div>
							</td>
						</tr>
						<?php 
                        break;
                    case "student":
                    case "peer":
                        $query = "SELECT * FROM `course_groups` AS a\n\t\t\t\t\t\t\t\t\tJOIN `courses` AS b\n\t\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\t\tORDER BY b.`course_name`,\n\t\t\t\t\t\t\t\t\t\tLENGTH(a.`group_name`),\n\t\t\t\t\t\t\t\t\t\ta.`group_name` ASC";
                        $temp_course_groups = $db->GetAll($query);
                        $course_groups = array();
                        if ($temp_course_groups) {
                            foreach ($temp_course_groups as $temp_course_group) {
                                $course_groups[$temp_course_group["cgroup_id"]] = $temp_course_group;
                            }
                        }
                        if (!isset($target_data["associated_cgroup_ids"]) && !isset($target_data["associated_cohort_ids"]) && !isset($target_data["associated_proxy_ids"])) {
                            if (isset($target_data["evaluation_targets"]) && is_array($target_data["evaluation_targets"])) {
                                foreach ($target_data["evaluation_targets"] as $target) {
                                    if ($target["target_type"] == "cgroup_id") {
                                        $target_data["associated_cgroup_ids"][] = $target["target_value"];
                                    } elseif ($target["target_type"] == "cohort") {
                                        $target_data["associated_cohort_ids"][] = $target["target_value"];
                                    } elseif ($target["target_type"] == "proxy_id") {
                                        $target_data["associated_proxy_ids"][] = $target["target_value"];
                                    }
                                }
                            }
                        }
                        unset($temp_course_groups);
                        ?>
						<tr>
							<td>&nbsp;</td>
							<td style="vertical-align: top"><label for="faculty_name" class="form-nrequired">Evaluation Targets</label></td>
							<td>
								<table>
									<tbody>
										<tr>
											<td style="vertical-align: top"><input type="radio" name="target_type" id="target_type_custom" value="custom" onclick="selectEvaluationTargetOption('custom')" style="vertical-align: middle" checked="checked" /></td>
											<td colspan="2" style="padding-bottom: 15px">
												<label for="target_type_custom" class="radio-group-title">Custom Evaluation Targets</label>
												<div class="content-small">This evaluation is intended for a custom selection of evaluation targets.</div>

												<div id="evaluation_target_type_custom_options" style="position: relative; margin-top: 10px;">
													<select id="target_type" onchange="showMultiSelect();" style="width: 275px;">
														<option value="">-- Select an target type --</option>
														<option value="cohorts">Cohorts of learners</option>
															<?php 
                        if ($course_groups) {
                            ?>
															<option value="course_groups">Course specific small groups</option>
															<?php 
                        }
                        ?>
														<option value="students">Individual learners</option>
													</select>

													<span id="options_loading" style="display:none; vertical-align: middle"><img src="<?php 
                        echo ENTRADA_RELATIVE;
                        ?>
/images/indicator.gif" width="16" height="16" alt="Please Wait" title="" style="vertical-align: middle" /> Loading ... </span>
													<span id="options_container"></span>
													<?php 
                        /**
                         * Compiles the list of groups from groups table (known as Cohorts).
                         */
                        $COHORT_LIST = array();
                        $results = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                        if ($results) {
                            foreach ($results as $result) {
                                $COHORT_LIST[$result["group_id"]] = $result;
                            }
                        }
                        $GROUP_LIST = $course_groups;
                        /**
                         * Compiles the list of students.
                         */
                        $STUDENT_LIST = array();
                        $query = "\tSELECT a.`id` AS `proxy_id`, b.`role`, CONCAT_WS(' ', a.`firstname`, a.`lastname`) AS `fullname`, a.`organisation_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`group` = 'student'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND a.`grad_year` >= '" . (date("Y") - (date("m") < 7 ? 2 : 1)) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY a.`grad_year` ASC, a.`lastname` ASC, a.`firstname` ASC";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                $STUDENT_LIST[$result["proxy_id"]] = array("proxy_id" => $result["proxy_id"], "fullname" => $result["fullname"], "organisation_id" => $result["organisation_id"]);
                            }
                        }
                        $target_data["form_id"] = $form_id;
                        if (!isset($target_data["associated_cohort_ids"]) && !isset($target_data["associated_cgroup_ids"]) && !isset($target_data["associated_proxy_ids"]) && isset($target_data["evaluation_id"])) {
                            $query = "SELECT * FROM `evaluation_targets` WHERE `evaluation_id` = " . $db->qstr($target_data["evaluation_id"]);
                            $results = $db->GetAll($query);
                            if ($results) {
                                $target_data["target_type"] = "custom";
                                foreach ($results as $result) {
                                    switch ($result["target_type"]) {
                                        case "cohort":
                                            $target_data["associated_cohort_ids"][] = (int) $result["target_value"];
                                            break;
                                        case "cgroup_id":
                                            $target_data["associated_cgroup_ids"][] = (int) $result["target_value"];
                                            break;
                                        case "proxy_id":
                                            $target_data["associated_proxy_ids"][] = (int) $result["target_value"];
                                            break;
                                    }
                                }
                            }
                        }
                        $cohort_ids_string = "";
                        $cgroup_ids_string = "";
                        $student_ids_string = "";
                        if (isset($target_data["associated_course_ids"]) && $target_data["associated_course_ids"]) {
                            $course_target_included = true;
                        } else {
                            $course_target_included = false;
                        }
                        if (isset($target_data["associated_cohort_ids"]) && is_array($target_data["associated_cohort_ids"])) {
                            foreach ($target_data["associated_cohort_ids"] as $group_id) {
                                if ($cohort_ids_string) {
                                    $cohort_ids_string .= ",group_" . $group_id;
                                } else {
                                    $cohort_ids_string = "group_" . $group_id;
                                }
                            }
                        }
                        if (isset($target_data["associated_cgroup_ids"]) && is_array($target_data["associated_cgroup_ids"])) {
                            foreach ($target_data["associated_cgroup_ids"] as $group_id) {
                                if ($cgroup_ids_string) {
                                    $cgroup_ids_string .= ",cgroup_" . $group_id;
                                } else {
                                    $cgroup_ids_string = "cgroup_" . $group_id;
                                }
                            }
                        }
                        if (isset($target_data["associated_proxy_ids"]) && is_array($target_data["associated_proxy_ids"])) {
                            foreach ($target_data["associated_proxy_ids"] as $proxy_id) {
                                if ($student_ids_string) {
                                    $student_ids_string .= ",student_" . $proxy_id;
                                } else {
                                    $student_ids_string = "student_" . $proxy_id;
                                }
                            }
                        }
                        ?>
													<input type="hidden" id="evaluation_target_cohorts" name="evaluation_target_cohorts" value="<?php 
                        echo $cohort_ids_string;
                        ?>
" />
													<input type="hidden" id="evaluation_target_course_groups" name="evaluation_target_course_groups" value="<?php 
                        echo $cgroup_ids_string;
                        ?>
" />
													<input type="hidden" id="evaluation_target_students" name="evaluation_target_students" value="<?php 
                        echo $student_ids_string;
                        ?>
" />
													<input type="hidden" id="evaluation_target_course" name="evaluation_target_course" value="<?php 
                        echo $course_target_included ? "1" : "0";
                        ?>
" />

													<ul class="menu multiselect" id="target_list" style="margin-top: 5px">
													<?php 
                        if (isset($target_data["associated_cohort_ids"]) && count($target_data["associated_cohort_ids"])) {
                            foreach ($target_data["associated_cohort_ids"] as $group) {
                                if (array_key_exists($group, $COHORT_LIST) && is_array($COHORT_LIST[$group])) {
                                    ?>
																<li class="group" id="target_group_<?php 
                                    echo $COHORT_LIST[$group]["group_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $COHORT_LIST[$group]["group_name"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('group_<?php 
                                    echo $COHORT_LIST[$group]["group_id"];
                                    ?>
', 'cohorts');" class="list-cancel-image" /></li>
																<?php 
                                }
                            }
                        }
                        if (isset($target_data["associated_cgroup_ids"]) && count($target_data["associated_cgroup_ids"])) {
                            foreach ($target_data["associated_cgroup_ids"] as $group) {
                                if (array_key_exists($group, $GROUP_LIST) && is_array($GROUP_LIST[$group])) {
                                    ?>
																<li class="group" id="target_cgroup_<?php 
                                    echo $GROUP_LIST[$group]["cgroup_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $GROUP_LIST[$group]["group_name"] . " - " . $GROUP_LIST[$group]["course_code"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('cgroup_<?php 
                                    echo $GROUP_LIST[$group]["cgroup_id"];
                                    ?>
', 'course_groups');" class="list-cancel-image" /></li>
																<?php 
                                }
                            }
                        }
                        if (isset($target_data["associated_proxy_ids"]) && count($target_data["associated_proxy_ids"])) {
                            foreach ($target_data["associated_proxy_ids"] as $student) {
                                if (array_key_exists($student, $STUDENT_LIST) && is_array($STUDENT_LIST[$student])) {
                                    ?>
																<li class="user" id="target_student_<?php 
                                    echo $STUDENT_LIST[$student]["proxy_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $STUDENT_LIST[$student]["fullname"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('student_<?php 
                                    echo $STUDENT_LIST[$student]["proxy_id"];
                                    ?>
', 'students');" class="list-cancel-image" /></li>
																<?php 
                                }
                            }
                        }
                        ?>
													</ul>
												</div>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<?php 
                        if ($target_details["target_shortname"] == "peer") {
                            ?>
							<tr>
								<td colspan="2">&nbsp;</td>
								<td>
									<?php 
                            echo display_notice("When creating peer assessments, learners will be able to assess any others within the same cohort, course group, or custom list of students, depending on which evaluation targets you include. <br /><br />Additionally, they will not be able to view results of evaluations done on themselves until they have filled out all of the required evaluations available to them, or the evaluation period ends, whichever comes first.");
                            ?>
								</td>
							</tr>
							<?php 
                        }
                        break;
                    case "rotation_core":
                        $target_data["form_id"] = $form_id;
                        if (!isset($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["evaluation_targets"] as $target) {
                                if ($target["target_type"] == "rotation_id") {
                                    $target_data["associated_rotation_ids"][] = $target["target_value"];
                                }
                            }
                        }
                        ?>
						<tr>
							<td>&nbsp;</td>
							<td style="vertical-align: top"><label for="faculty_name" class="form-nrequired">Evaluation Targets</label></td>
							<td>
								<table>
									<tbody>
										<tr>
											<td style="vertical-align: top"><input type="radio" name="target_type" id="target_type_rotations" value="rotations" onclick="selectEvaluationTargetOption('rotations')" style="vertical-align: middle"  checked="checked" /></td>
											<td colspan="2" style="padding-bottom: 15px">
												<label for="target_type_rotations" class="radio-group-title">Each Service in the selected Core Rotation</label>
												<div class="content-small">This evaluation is intended for all events associated with a custom selection of Core Rotations.</div>
												<?php 
                        $ROTATION_LIST = array();
                        $rotations[0] = array("text" => "All Core Rotations", "value" => "all", "category" => true);
                        $query = "SELECT * FROM `" . CLERKSHIP_DATABASE . "`.`global_lu_rotations`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `rotation_id` != " . $db->qstr(MAX_ROTATION);
                        $rotation_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                        if ($rotation_results) {
                            foreach ($rotation_results as $rotation) {
                                $ROTATION_LIST[$rotation["rotation_id"]] = $rotation;
                                if (isset($target_data["associated_rotation_ids"]) && is_array($target_data["associated_rotation_ids"]) && in_array($rotation["rotation_id"], $target_data["associated_rotation_ids"])) {
                                    $checked = "checked=\"checked\"";
                                } else {
                                    $checked = "";
                                }
                                $rotations[0]["options"][] = array("text" => $rotation["rotation_title"], "class" => "cat_enabled", "value" => "rotation_" . $rotation["rotation_id"], "checked" => $checked);
                            }
                            echo lp_multiple_select_inline("rotations", $rotations, array("title" => "Select Core Rotations:", "hidden" => false, "class" => "select_multiple_area_container", "category_check_all" => true, "submit" => false));
                        } else {
                            echo display_notice("There are no core rotations available.");
                        }
                        if (isset($target_data["associated_rotation_ids"]) && is_array($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["associated_rotation_ids"] as $rotation_id) {
                                if ($rotation_ids_string) {
                                    $rotation_ids_string .= ",rotation_" . $rotation_id;
                                } else {
                                    $rotation_ids_string = "rotation_" . $rotation_id;
                                }
                            }
                        }
                        ?>
												<input type="hidden" id="evaluation_target_rotations" name="evaluation_target_rotations" value="<?php 
                        echo $rotation_ids_string;
                        ?>
" />
												<ul class="menu multiselect" id="target_list" style="margin-top: 5px;">
													<?php 
                        if (is_array($target_data["associated_rotation_ids"]) && count($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["associated_rotation_ids"] as $rotation) {
                                if (array_key_exists($rotation, $ROTATION_LIST) && is_array($ROTATION_LIST[$rotation])) {
                                    ?>
																<li class="group" id="target_rotation_<?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_title"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('rotation_<?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_id"];
                                    ?>
', 'rotations');" class="list-cancel-image" style="position: relative; float: right;" /></li>
																<?php 
                                }
                            }
                        }
                        ?>
												</ul>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("When creating core rotation evaluations, the list of <strong>Core Rotations</strong>, <strong>Evaluators</strong>, the <strong>Evaluation Start</strong>, and the <strong>Evaluation Finish</strong> determine which electives will be targeted for evaluation. <br /><br />Each of the services in one of selected <strong>Core Rotations</strong> which ends between the <strong>Evaluation Start</strong> and the <strong>Evaluation Finish</strong> for learners in the <strong>Evaluators</strong> list will require/allow an evaluation to be completed on it.");
                        ?>
							</td>
						</tr>
						<?php 
                        break;
                    case "rotation_elective":
                        ?>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("When creating clerkship elective evaluations, the list of <strong>Evaluators</strong>, the <strong>Evaluation Start</strong>, and the <strong>Evaluation Finish</strong> determine which electives will be targeted for evaluation. <br /><br />Each elective which ends between the <strong>Evaluation Start</strong> and the <strong>Evaluation Finish</strong> for learners in the <strong>Evaluators</strong> list will require/allow an evaluation to be completed on it.");
                        ?>
							</td>
						</tr>
						<?php 
                        break;
                    case "preceptor":
                        $target_data["form_id"] = $form_id;
                        if (!isset($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["evaluation_targets"] as $target) {
                                if ($target["target_type"] == "rotation_id") {
                                    $target_data["associated_rotation_ids"][] = $target["target_value"];
                                }
                            }
                        }
                        ?>
						<tr>
							<td>&nbsp;</td>
							<td style="vertical-align: top"><label for="faculty_name" class="form-nrequired">Evaluation Targets</label></td>
							<td>
								<table>
									<tbody>
										<tr>
											<td style="vertical-align: top"><input type="hidden" name="target_subtype" value="preceptor" /><input type="radio" name="target_type" id="target_type_rotations" value="rotations" onclick="selectEvaluationTargetOption('rotations')" style="vertical-align: middle"  checked="checked" /></td>
											<td colspan="2" style="padding-bottom: 15px">
												<label for="target_type_rotations" class="radio-group-title">Each Service in the selected Clerkship Rotation</label>
												<div class="content-small">This evaluation is intended for all events associated with a custom selection of Clerkship Rotations.</div>
												<?php 
                        $ROTATION_LIST = array();
                        $rotations[0] = array("text" => "All Clerkship Rotations", "value" => "all", "category" => true);
                        $query = "\tSELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`global_lu_rotations`";
                        $rotation_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                        if ($rotation_results) {
                            foreach ($rotation_results as $rotation) {
                                $ROTATION_LIST[$rotation["rotation_id"]] = $rotation;
                                if (isset($target_data["associated_rotation_ids"]) && is_array($target_data["associated_rotation_ids"]) && in_array($rotation["rotation_id"], $target_data["associated_rotation_ids"])) {
                                    $checked = "checked=\"checked\"";
                                } else {
                                    $checked = "";
                                }
                                $rotations[0]["options"][] = array("text" => $rotation["rotation_title"], "value" => "rotation_" . $rotation["rotation_id"], "class" => "cat_enabled", "checked" => $checked);
                            }
                            echo lp_multiple_select_inline("rotations", $rotations, array("title" => "Select Clerkship Rotations:", "hidden" => false, "class" => "select_multiple_area_container", "category_check_all" => true, "submit" => false));
                        } else {
                            echo display_notice("There are no clerkship rotations available.");
                        }
                        if (isset($target_data["associated_rotation_ids"]) && is_array($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["associated_rotation_ids"] as $rotation_id) {
                                if ($rotation_ids_string) {
                                    $rotation_ids_string .= ",rotation_" . $rotation_id;
                                } else {
                                    $rotation_ids_string = "rotation_" . $rotation_id;
                                }
                            }
                        }
                        ?>
												<input type="hidden" id="evaluation_target_rotations" name="evaluation_target_rotations" value="<?php 
                        echo $rotation_ids_string;
                        ?>
" />
												<ul class="menu multiselect" id="target_list" style="margin-top: 5px;">
													<?php 
                        if (is_array($target_data["associated_rotation_ids"]) && count($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["associated_rotation_ids"] as $rotation) {
                                if (array_key_exists($rotation, $ROTATION_LIST) && is_array($ROTATION_LIST[$rotation])) {
                                    ?>
																<li class="group" id="target_rotation_<?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_title"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('rotation_<?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_id"];
                                    ?>
', 'rotations');" class="list-cancel-image" style="position: relative; float: right;" /></li>
																<?php 
                                }
                            }
                        }
                        ?>
												</ul>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("When creating clerkship preceptor evaluations, the list of <strong>Rotations</strong>, <strong>Evaluators</strong>, the <strong>Evaluation Start</strong>, and the <strong>Evaluation Finish</strong> determine which electives will be targeted for evaluation. <br /><br />Each preceptor for services in one of the selected <strong>Rotations</strong> which ends between the <strong>Evaluation Start</strong> and the <strong>Evaluation Finish</strong> for learners in the <strong>Evaluators</strong> list will require/allow an evaluation to be completed on it.");
                        ?>
							</td>
						</tr>
						<?php 
                        break;
                    case "self":
                        ?>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("When creating self evaluations, the list of evaluators also acts as the target, as learners can only evaluate themselves.");
                        ?>
							</td>
						</tr>
						<?php 
                        break;
                    default:
                        ?>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("The target that you have selected is not currently available.");
                        ?>
							</td>
						</tr>
						<?php 
                        application_log("error", "Unaccounted for target_shortname [" . $target_details["target_shortname"] . "] encountered. An update to api-targets.inc.php is required.");
                        break;
                }
                if ($target_details["target_shortname"] != "peer" && $target_details["target_shortname"] != "student" && $target_details["target_shortname"] != "resident") {
                    ?>
					<tr>
						<td colspan="3">&nbsp;</td>
					</tr>
					<tr>
						<td></td>
						<td style="vertical-align: top">
							<label for="PickList" class="form-required">Select Students</label>
							<div class="content-small"><strong>Hint:</strong> Select the student or students you would like to evaluate the teachers above.</div>
						</td>
						<td style="vertical-align: top">
							<table style="width: 100%" cellspacing="0" cellpadding="0">
								<colgroup>
									<col style="width: 4%" />
									<col style="width: 96%" />
								</colgroup>
								<tbody>
									<tr>
										<td style="vertical-align: top"><input<?php 
                    echo isset($target_data["evaluation_evaluators"][0]["evaluator_type"]) && $target_data["evaluation_evaluators"][0]["evaluator_type"] == "cohort" ? " checked=\"checked\"" : "";
                    ?>
 type="radio" name="target_group_type" id="target_group_type_cohort" value="cohort" onclick="selectTargetGroupOption(this.value)" style="vertical-align: middle" /></td>
										<td style="padding-bottom: 15px">
											<label for="target_group_type_cohort" class="radio-group-title">Entire class must complete this evaluation</label>
											<div class="content-small">This evaluation must be completed by everyone in the selected class.</div>
										</td>
									</tr>
									<tr class="target_group cohort_target">
										<td></td>
										<td style="vertical-align: middle" class="content-small">
											<label for="cohort" class="form-required">All students in</label>
											<select id="cohort" name="cohort" style="width: 203px; vertical-align: middle">
												<?php 
                    $active_cohorts = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                    if (isset($active_cohorts) && !empty($active_cohorts)) {
                        foreach ($active_cohorts as $cohort) {
                            echo "<option value=\"" . $cohort["group_id"] . "\"" . ($target_data["evaluation_evaluators"][0]["evaluator_type"] == "cohort" && $target_data["evaluation_evaluators"][0]["evaluator_value"] == $cohort["group_id"] ? " selected=\"selected\"" : "") . ">" . html_encode($cohort["group_name"]) . "</option>\n";
                        }
                    }
                    ?>
											</select>
										</td>
									</tr>
									<tr>
										<td colspan="2">&nbsp;</td>
									</tr>
									<tr>
										<td style="vertical-align: top"><input type="radio" name="target_group_type" id="target_group_type_percentage" value="percentage" onclick="selectTargetGroupOption(this.value)" style="vertical-align: middle" /></td>
										<td style="padding-bottom: 15px">
											<label for="target_group_type_percentage" class="radio-group-title">Percentage of class must complete this evaluation</label>
											<div class="content-small">This evaluation must be completed by certain percentage of students in the selected class.</div>
										</td>
									</tr>
									<tr class="target_group percentage_target">
										<td>&nbsp;</td>
										<td style="vertical-align: middle" class="content-small">
											<input type="text" class="percentage" id="percentage_percent" name="percentage_percent" style="width: 30px; vertical-align: middle" maxlength="3" value="100" /> <label for="percentage_cohort" class="form-required">of the</label>
											<select id="percentage_cohort" name="percentage_cohort" style="width: 203px; vertical-align: middle">
											<?php 
                    $active_cohorts = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                    if (isset($active_cohorts) && !empty($active_cohorts)) {
                        foreach ($active_cohorts as $cohort) {
                            echo "<option value=\"" . $cohort["group_id"] . "\">" . html_encode($cohort["group_name"]) . "</option>\n";
                        }
                    }
                    ?>
											</select>
										</td>
									</tr>
									<tr>
										<td colspan="2">&nbsp;</td>
									</tr>
									<tr>
										<td style="vertical-align: top"><input<?php 
                    echo isset($target_data["evaluation_evaluators"][0]["evaluator_type"]) && $target_data["evaluation_evaluators"][0]["evaluator_type"] == "cgroup_id" ? " checked=\"checked\"" : "";
                    ?>
 type="radio" name="target_group_type" id="target_group_type_cgroup_id" value="cgroup_id" onclick="selectTargetGroupOption(this.value)" style="vertical-align: middle" /></td>
										<td style="padding-bottom: 15px">
											<label for="target_group_type_cgroup_id" class="radio-group-title">Selected course groups must complete this evaluation</label>
											<div class="content-small">This evaluation must be completed by everyone in the selected course groups.</div>
										</td>
									</tr>
									<tr class="target_group cgroup_id_target">
										<td></td>
										<td style="vertical-align: middle" class="content-small">
											<label for="cgroup_ids" class="form-required">All students in</label>
											<select multiple="multiple" id="cgroup_ids" name="cgroup_ids[]" style="width: 450px; height: 200px; vertical-align: top;"><?php 
                    $query = "SELECT * FROM `course_groups` AS a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN `courses` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE b.`course_active` = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND a.`active` = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`organisation_id` = " . $ENTRADA_USER->getActiveOrganisation() . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY b.`course_name`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLENGTH(a.`group_name`),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ta.`group_name` ASC";
                    $temp_course_groups = $db->GetAll($query);
                    $course_groups = array();
                    if ($temp_course_groups) {
                        foreach ($temp_course_groups as $temp_course_group) {
                            $course_groups[$temp_course_group["cgroup_id"]] = $temp_course_group;
                        }
                    }
                    $evaluator_cgroup_ids = array();
                    foreach ($target_data["evaluation_evaluators"] as $evaluator) {
                        if ($evaluator["evaluator_type"] == "cgroup_id") {
                            $evaluator_cgroup_ids[] = $evaluator["evaluator_value"];
                        }
                    }
                    if (isset($course_groups) && !empty($course_groups)) {
                        $last_course_name = false;
                        foreach ($course_groups as $course_group) {
                            if ($course_group["course_name"] && $last_course_name != $course_group["course_name"]) {
                                if ($last_course_name) {
                                    echo "</optgroup>\n";
                                }
                                $last_course_name = $course_group["course_name"];
                                echo "<optgroup label=\"" . $course_group["course_name"] . ($course_group["course_code"] ? " - " . $course_group["course_code"] : "") . "\">\n";
                            }
                            echo "<option value=\"" . $course_group["cgroup_id"] . "\"" . (in_array($course_group["cgroup_id"], $evaluator_cgroup_ids) ? " selected=\"selected\"" : "") . ">" . html_encode($course_group["group_name"]) . "</option>\n";
                        }
                        if ($last_course_name) {
                            echo "</optgroup>\n";
                        }
                    }
                    ?>
											</select>
										</td>
									</tr>
									<tr>
										<td colspan="2">&nbsp;</td>
									</tr>
									<tr >
										<td style="vertical-align: top"><input<?php 
                    echo isset($target_data["evaluation_evaluators"][0]["evaluator_type"]) && $target_data["evaluation_evaluators"][0]["evaluator_type"] == "proxy_id" ? " checked=\"checked\"" : "";
                    ?>
 type="radio" name="target_group_type" id="target_group_type_proxy_id" value="proxy_id" onclick="selectTargetGroupOption(this.value)" style="vertical-align: middle" /></td>
										<td style="padding-bottom: 15px">
											<label for="target_group_type_proxy_id" class="radio-group-title">Selected students must complete this evaluation</label>
											<div class="content-small">This evaluation must be completed only by the selected individuals.</div>
										</td>
									</tr>
									<tr class="target_group proxy_id_target">
										<td>&nbsp;</td>
										<td style="vertical-align: middle" class="content-small">
											<label for="student_name" class="form-required">Student Name</label>

											<input type="text" id="student_name" name="fullname" size="30" autocomplete="off" style="width: 203px; vertical-align: middle" />
											<div class="autocomplete" id="student_name_auto_complete"></div>

											<input type="hidden" id="associated_student" name="associated_student" />
											<input type="button" class="btn btn-small" id="add_associated_student" value="Add" style="vertical-align: middle" />
											<span class="content-small" style="margin-left: 3px; padding-top: 5px"><strong>e.g.</strong> <?php 
                    echo html_encode($_SESSION["details"]["lastname"] . ", " . $_SESSION["details"]["firstname"]);
                    ?>
</span>
											<ul id="student_list" class="menu" style="margin-top: 15px">
												<?php 
                    if ($target_data["evaluation_evaluators"][0]["evaluator_type"] == "proxy_id" && is_array($target_data["evaluation_evaluators"]) && !empty($target_data["evaluation_evaluators"])) {
                        foreach ($target_data["evaluation_evaluators"] as $evaluator) {
                            $proxy_id = (int) $evaluator["evaluator_value"];
                            ?>
														<li class="community" id="student_<?php 
                            echo $proxy_id;
                            ?>
" style="cursor: move;"><?php 
                            echo get_account_data("fullname", $proxy_id);
                            ?>
<img src="<?php 
                            echo ENTRADA_URL;
                            ?>
/images/action-delete.gif" onclick="student_list.removeItem('<?php 
                            echo $proxy_id;
                            ?>
');" class="list-cancel-image" /></li>
														<?php 
                        }
                    }
                    ?>
											</ul>
											<input type="hidden" id="student_ref" name="student_ref" value="" />
											<input type="hidden" id="student_id" name="student_id" value="" />
										</td>
									</tr>
								</tbody>
							</table>
							<div id="scripts-on-open" style="display: none;">
								$('submittable_notice').update('&nbsp;');
								selectTargetGroupOption('<?php 
                    echo isset($target_data["evaluation_evaluators"][0]["evaluator_type"]) ? $target_data["evaluation_evaluators"][0]["evaluator_type"] : 'cohort';
                    ?>
');
								student_list = new AutoCompleteList({ type: 'student', url: '<?php 
                    echo ENTRADA_RELATIVE;
                    ?>
/api/personnel.api.php?type=student', remove_image: '<?php 
                    echo ENTRADA_RELATIVE;
                    ?>
/images/action-delete.gif' });
								<?php 
                    if (in_array($target_details["target_shortname"], array("course", "rotation_core", "preceptor"))) {
                        ?>
									$('directors_select').show();
									$('pcoordinators_select').show();
									$('tutors_select').hide();
									<?php 
                    } elseif ($target_details["target_shortname"] == "self") {
                        ?>
									$('tutors_select').show();
									$('directors_select').hide();
									$('pcoordinators_select').hide();
									<?php 
                    }
                    ?>
							</div>
						</td>
					</tr>
					<?php 
                } elseif ($target_details["target_shortname"] == "peer") {
                    ?>
					<tr>
						<td colspan="3">
							<div id="scripts-on-open" style="display: none;">
								$('tutors_select').show();
								$('submittable_notice').update('<div class="display-notice"><ul><li>If you set the Min or Max Submittable for a Peer Evaluation to 0, the value will default to the number of targets available to evaluate.</li></ul></div>');
							</div>
						</td>
					</tr
					<?php 
                } elseif ($target_details["target_shortname"] == "student" || $target_details["target_shortname"] == "resident") {
                    ?>
					<tr>
						<td colspan="3">&nbsp;</td>
					</tr
					<tr>
						<td></td>
						<td style="vertical-align: top"><label for="evalfaculty_name" class="form-required">Faculty Evaluators</label></td>
						<td>
							<input type="hidden" name="target_group_type" id="target_group_type_faculty" value="faculty" style="vertical-align: middle" />
							<div id="scripts-on-open" style="display: none;">
								faculty_list = new AutoCompleteList(
									{
										type: 'evalfaculty',
										url: '<?php 
                    echo ENTRADA_RELATIVE;
                    ?>
/api/personnel.api.php?type=evalfaculty',
										remove_image: '<?php 
                    echo ENTRADA_RELATIVE;
                    ?>
/images/action-delete.gif'
									});
								$('tutors_select').show();
								$('directors_select').hide();
								$('pcoordinators_select').hide();
								$('submittable_notice').update('&nbsp;');
							</div>
							<input type="text" id="evalfaculty_name" name="fullname" size="30" autocomplete="off" style="width: 203px; vertical-align: middle" />
							<div class="autocomplete" id="evalfaculty_name_auto_complete"></div>
							<input type="hidden" id="associated_evalfaculty" name="associated_evalfaculty" />
							<input type="button" class="btn btn-small" id="add_associated_evalfaculty" value="Add" style="vertical-align: middle" />
							<span class="content-small">(<strong>Example:</strong> <?php 
                    echo html_encode($_SESSION["details"]["lastname"] . ", " . $_SESSION["details"]["firstname"]);
                    ?>
)</span>
							<ul id="evalfaculty_list" class="menu" style="margin-top: 15px">
								<?php 
                    if ($target_data["evaluation_evaluators"][0]["evaluator_type"] == "proxy_id" && is_array($target_data["evaluation_evaluators"]) && !empty($target_data["evaluation_evaluators"])) {
                        foreach ($target_data["evaluation_evaluators"] as $evaluator) {
                            $proxy_id = (int) $evaluator["evaluator_value"];
                            ?>
										<li class="community" id="evalfaculty_<?php 
                            echo $proxy_id;
                            ?>
" style="cursor: move;"><?php 
                            echo get_account_data("fullname", $proxy_id);
                            ?>
<img src="<?php 
                            echo ENTRADA_URL;
                            ?>
/images/action-delete.gif" onclick="faculty_list.removeItem('<?php 
                            echo $proxy_id;
                            ?>
');" class="list-cancel-image" /></li>
										<?php 
                        }
                    }
                    ?>
							</ul>
							<input type="hidden" id="evalfaculty_ref" name="evalfaculty_ref" value="" />
							<input type="hidden" id="evalfaculty_id" name="evalfaculty_id" value="" />
						</td>
					</tr>
					<?php 
                }
            }
        } else {
            $organisation[$ENTRADA_USER->getActiveOrganisation()] = array("text" => fetch_organisation_title($ENTRADA_USER->getActiveOrganisation()), "value" => "organisation_" . $ENTRADA_USER->getActiveOrganisation(), "category" => true);
            switch ($options_for) {
                case "cohorts":
                    // Classes
                    /**
                     * Cohorts.
                     */
                    if (isset($target_data["evaluation_target_cohorts"])) {
                        $associated_targets = explode(',', $target_data["evaluation_target_cohorts"]);
                        if (isset($associated_targets) && is_array($associated_targets) && count($associated_targets)) {
                            foreach ($associated_targets as $target_id) {
                                if (strpos($target_id, "group") !== false) {
                                    if ($group_id = clean_input(preg_replace("/[a-z_]/", "", $target_id), array("trim", "int"))) {
                                        $query = "\tSELECT * FROM `groups`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `group_id` = " . $db->qstr($group_id) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND `group_active` = 1";
                                        $result = $db->GetRow($query);
                                        if ($result) {
                                            $target_data["associated_cohort_ids"][] = $group_id;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $groups = $organisation;
                    $groups_results = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                    if ($groups_results) {
                        foreach ($groups_results as $group) {
                            if (isset($target_data["associated_cohort_ids"]) && is_array($target_data["associated_cohort_ids"]) && in_array($group["group_id"], $target_data["associated_cohort_ids"])) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = "";
                            }
                            $groups[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $group["group_name"], "value" => "group_" . $group["group_id"], "checked" => $checked);
                        }
                        echo lp_multiple_select_popup("cohorts", $groups, array("title" => "Select Cohorts of Learners:", "submit_text" => "Close", "submit" => true));
                    } else {
                        echo display_notice("There are no cohorts of learners available.");
                    }
                    break;
                case "course_groups":
                    /**
                     * Course Groups
                     */
                    if (isset($target_data["evaluation_target_course_groups"])) {
                        $associated_targets = explode(',', $target_data["evaluation_target_course_groups"]);
                        if (isset($associated_targets) && is_array($associated_targets) && count($associated_targets)) {
                            foreach ($associated_targets as $target_id) {
                                if (strpos($target_id, "cgroup") !== false) {
                                    if ($cgroup_id = clean_input(preg_replace("/[a-z_]/", "", $target_id), array("trim", "int"))) {
                                        $query = "\tSELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `course_groups`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `cgroup_id` = " . $db->qstr($cgroup_id) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (`active` = '1')";
                                        $result = $db->GetRow($query);
                                        if ($result) {
                                            $target_data["associated_cgroup_ids"][] = $cgroup_id;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $groups = $organisation;
                    $query = "SELECT a.*, b.`course_name`, b.`course_code` FROM `course_groups` AS a\n\t\t\t\t\t\t\t\tJOIN `courses` AS b\n\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\tWHERE b.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\t\tORDER BY b.`course_name`,\n\t\t\t\t\t\t\t\t\tLENGTH(a.`group_name`),\n\t\t\t\t\t\t\t\t\ta.`group_name` ASC";
                    $groups_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                    if ($groups_results) {
                        $last_course_category = "";
                        foreach ($groups_results as $group) {
                            if ($last_course_category != $group["course_name"]) {
                                $last_course_category = $group["course_name"];
                                $groups[$group["course_id"]] = array("text" => $group["course_name"], "value" => "course_" . $group["course_id"], "category" => true);
                            }
                            if (isset($target_data["associated_cgroup_ids"]) && is_array($target_data["associated_cgroup_ids"]) && in_array($group["cgroup_id"], $target_data["associated_cgroup_ids"])) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = "";
                            }
                            $groups[$group["course_id"]]["options"][] = array("text" => $group["group_name"] . ($group["course_code"] ? " - " . $group["course_code"] : ""), "value" => "cgroup_" . $group["cgroup_id"], "checked" => $checked);
                        }
                        echo lp_multiple_select_popup("course_groups", $groups, array("title" => "Select Course Specific Small Groups:", "submit_text" => "Close", "submit" => true));
                    } else {
                        //echo display_notice("There are no small groups in the course you have selected.");
                    }
                    break;
                case "students":
                    // Students
                    /**
                     * Learners
                     */
                    if (isset($target_data["evaluation_target_students"])) {
                        $associated_targets = explode(',', $target_data["evaluation_target_students"]);
                        if (isset($associated_targets) && is_array($associated_targets) && count($associated_targets)) {
                            foreach ($associated_targets as $target_id) {
                                if (strpos($target_id, "student") !== false) {
                                    if ($proxy_id = clean_input(preg_replace("/[a-z_]/", "", $target_id), array("trim", "int"))) {
                                        $query = "\tSELECT a.*\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE a.`id` = " . $db->qstr($proxy_id) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")";
                                        $result = $db->GetRow($query);
                                        if ($result) {
                                            $target_data["associated_proxy_ids"][] = $proxy_id;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $students = $organisation;
                    $query = "\tSELECT a.`id` AS `proxy_id`, a.`organisation_id`, b.`role`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\tJOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\tWHERE b.`app_id` IN (" . AUTH_APP_IDS_STRING . ")\n\t\t\t\t\t\t\t\tAND a.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\tAND b.`group` = 'student'\n\t\t\t\t\t\t\t\tAND a.`grad_year` >= " . $db->qstr(fetch_first_year() - 4) . ($ENTRADA_USER->getGroup() == "student" ? " AND a.`id` = " . $db->qstr($ENTRADA_USER->getID()) : "") . "\n\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\tORDER BY a.`grad_year` DESC, a.`lastname` ASC, a.`firstname` ASC";
                    $student_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                    if ($student_results) {
                        foreach ($student_results as $student) {
                            if (isset($target_data["associated_proxy_ids"]) && is_array($target_data["associated_proxy_ids"]) && in_array($student["proxy_id"], $target_data["associated_proxy_ids"])) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = "";
                            }
                            $students[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $student["fullname"], "value" => "student_" . $student["proxy_id"], "checked" => $checked);
                        }
                        echo lp_multiple_select_popup("students", $students, array("title" => "Select Individual Learners:", "submit_text" => "Close", "submit" => true));
                    } else {
                        echo display_notice("There are no students available.");
                    }
                    break;
                case "residents":
                    // Residents
                    if (isset($target_data["evaluation_target_residents"])) {
                        $associated_targets = explode(',', $target_data["evaluation_target_residents"]);
                        if (isset($associated_targets) && is_array($associated_targets) && count($associated_targets)) {
                            foreach ($associated_targets as $target_id) {
                                if (strpos($target_id, "resident") !== false) {
                                    if ($proxy_id = clean_input(preg_replace("/[a-z_]/", "", $target_id), array("trim", "int"))) {
                                        $query = "\tSELECT a.*\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE a.`id` = " . $db->qstr($proxy_id) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")";
                                        $result = $db->GetRow($query);
                                        if ($result) {
                                            $target_data["associated_proxy_ids"][] = $proxy_id;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $residents = $organisation;
                    $query = "\tSELECT a.`id` AS `proxy_id`, a.`organisation_id`, b.`role`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\tJOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\tWHERE b.`app_id` IN (" . AUTH_APP_IDS_STRING . ")\n\t\t\t\t\t\t\t\tAND a.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\tAND b.`group` = 'student'\n\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\tORDER BY a.`grad_year` DESC, a.`lastname` ASC, a.`firstname` ASC";
                    $resident_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                    if ($resident_results) {
                        foreach ($resident_results as $resident) {
                            if (isset($target_data["associated_proxy_ids"]) && is_array($target_data["associated_proxy_ids"]) && in_array($resident["proxy_id"], $target_data["associated_proxy_ids"])) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = "";
                            }
                            $residents[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $resident["fullname"], "value" => "resident_" . $g["proxy_id"], "checked" => $checked);
                        }
                        echo lp_multiple_select_popup("residents", $residents, array("title" => "Select Individual Learners:", "submit_text" => "Close", "submit" => true));
                    } else {
                        echo display_notice("There are no residents available.");
                    }
                    break;
                default:
                    application_log("notice", "Unknown evaluation target filter type [" . $options_for . "] provided to evaluation targets API.");
                    break;
            }
        }
    }
 /** create the appropriate database tables for this bean */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->dbManager->createTable($this);
             if ($this->bean_implements('ACL')) {
                 ACLAction::addActions($this->module_dir);
             }
         } else {
             echo "Table Already Exists : {$this->table_name}<br>";
         }
     }
 }
Beispiel #11
0
 /**
  * Метод, предназанченный для сборки всей страницы в единое целое.
  *
  * @param int $id идентификатор документа
  * @param int $rub_id идентификатор рубрики
  */
 function coreSiteFetch($id, $rub_id = '')
 {
     global $AVE_DB;
     // Если происходит вызов модуля, получаем соответствующие мета-теги и получаем шаблон модуля
     if (!empty($_REQUEST['module'])) {
         $out = $this->_coreModuleMetatagsFetch();
         $out = $this->_coreDocumentTemplateGet('', '', $this->_coreModuleTemplateGet());
     } else {
         if (!isset($this->curentdoc->Id) && !$this->_coreCurrentDocumentFetch($id, UGROUP)) {
             // Определяем документ с 404 ошиюкой, в случае, если документ не найден
             if ($this->_corePageNotFoundFetch(PAGE_NOT_FOUND_ID, UGROUP)) {
                 $_REQUEST['id'] = $_GET['id'] = $id = PAGE_NOT_FOUND_ID;
             }
         }
         // проверяем параметры публикации документа
         if (!$this->_coreDocumentIsPublished()) {
             $this->_coreErrorPage404();
         }
         // Определяем права доступа к документам рубрики
         define('RUB_ID', !empty($rub_id) ? $rub_id : $this->curentdoc->rubric_id);
         $this->_coreRubricPermissionFetch(RUB_ID);
         if (!(isset($_SESSION[RUB_ID . '_docread']) && $_SESSION[RUB_ID . '_docread'] == 1 || isset($_SESSION[RUB_ID . '_alles']) && $_SESSION[RUB_ID . '_alles'] == 1)) {
             // читать запрещено - извлекаем ругательство и отдаём вместо контента
             $main_content = get_settings('message_forbidden');
         } else {
             if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) {
                 // увеличиваем счетчик версий для печати
                 $AVE_DB->Query("\n\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\n\t\t\t\t\t\tSET document_count_print = document_count_print+1\n\t\t\t\t\t\tWHERE Id = '" . $id . "'\n\t\t\t\t\t");
             } else {
                 if (!isset($_SESSION['doc_view'][$id])) {
                     // увеличиваем счетчик просмотров (1 раз в пределах сессии)
                     $AVE_DB->Query("\n\t\t\t\t\t\t\tUPDATE " . PREFIX . "_documents\n\t\t\t\t\t\t\tSET document_count_view = document_count_view+1\n\t\t\t\t\t\t\tWHERE Id = '" . $id . "'\n\t\t\t\t\t\t");
                     $_SESSION['doc_view'][$id] = time();
                 }
                 $curdate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
                 if (!isset($_SESSION['doc_view_dayly[' . $curdate . '][' . $id . ']'])) {
                     // и подневный счетчик просмотров тоже увеличиваем
                     $curdate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
                     $AVE_DB->Query("\n                            UPDATE\n                                " . PREFIX . "_view_count\n                            SET\n                                count = count + 1\n                            WHERE\n                                document_id = '" . $id . "' AND\n                                day_id = '" . $curdate . "'\n                        ");
                     if (!$AVE_DB->_handle->affected_rows) {
                         $AVE_DB->Query("\n                                INSERT INTO " . PREFIX . "_view_count (\n                                    document_id,\n                                    day_id,\n                                    count\n                                )\n                                VALUES (\n                                    '" . $id . "',  '" . $curdate . "', '1'\n                                )\n                            ");
                     }
                     $_SESSION['doc_view_dayly[' . $curdate . '][' . $id . ']'] = time();
                 }
             }
             if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) {
                 // кэширование разрешено
                 // извлекаем скомпилированный шаблон документа из кэша
                 $main_content = $AVE_DB->Query("\n\t\t\t\t\t\tSELECT compiled\n\t\t\t\t\t\tFROM " . PREFIX . "_rubric_template_cache\n\t\t\t\t\t\tWHERE hash  = '" . $this->_get_cache_hash() . "'\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t")->GetCell();
             } else {
                 // кэширование запрещено
                 $main_content = false;
             }
             if (empty($main_content)) {
                 // кэш пустой или отключен, извлекаем и компилируем шаблон
                 if (!empty($this->curentdoc->rubric_template)) {
                     $rubTmpl = $this->curentdoc->rubric_template;
                 } else {
                     $rubTmpl = $AVE_DB->Query("\n\t\t\t\t\t\t\tSELECT rubric_template\n\t\t\t\t\t\t\tFROM " . PREFIX . "_rubrics\n\t\t\t\t\t\t\tWHERE Id = '" . RUB_ID . "'\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t")->GetCell();
                 }
                 $rubTmpl = trim($rubTmpl);
                 if (empty($rubTmpl)) {
                     // не задан шаблон рубрики
                     $main_content = $this->_rubric_template_empty;
                 } else {
                     // парсим теги полей в шаблоне документа
                     $main_content = preg_replace_callback('/\\[tag:fld:([a-zA-Z0-9-_]+)\\]/', 'document_get_field', $rubTmpl);
                     $main_content = preg_replace_callback('/\\[tag:([r|c|f|t]\\d+x\\d+r*):(.+?)]/', 'callback_make_thumbnail', $main_content);
                     // удаляем ошибочные теги полей
                     $main_content = preg_replace('/\\[tag:fld:\\d*\\]/', '', $main_content);
                     if (CACHE_DOC_TPL && empty($_POST) && !(isset($_SESSION['user_adminmode']) && $_SESSION['user_adminmode'] == 1)) {
                         // кэширование разрешено
                         // сохраняем скомпилированный шаблон в кэш
                         $AVE_DB->Query("\n\t\t\t\t\t\t\t\tINSERT " . PREFIX . "_rubric_template_cache\n\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\thash     = '" . $this->_get_cache_hash() . "',\n\t\t\t\t\t\t\t\t\trub_id   = '" . RUB_ID . "',\n\t\t\t\t\t\t\t\t\tgrp_id   = '" . UGROUP . "',\n\t\t\t\t\t\t\t\t\tdoc_id   = '" . $id . "',\n\t\t\t\t\t\t\t\t\tcompiled = '" . addslashes($main_content) . "'\n\t\t\t\t\t\t\t");
                     }
                 }
             }
             $main_content = preg_replace('/\\[tag:date:([a-zA-Z0-9-]+)\\]/e', "RusDate(date('\$1', " . $this->curentdoc->document_published . "))", $main_content);
             $main_content = str_replace('[tag:docdate]', pretty_date(strftime(DATE_FORMAT, $this->curentdoc->document_published)), $main_content);
             $main_content = str_replace('[tag:doctime]', pretty_date(strftime(TIME_FORMAT, $this->curentdoc->document_published)), $main_content);
             $main_content = str_replace('[tag:docauthorid]', $this->curentdoc->document_author_id, $main_content);
             $main_content = str_replace('[tag:docauthor]', get_username_by_id($this->curentdoc->document_author_id), $main_content);
         }
         $out = str_replace('[tag:maincontent]', $main_content, $this->_coreDocumentTemplateGet(RUB_ID));
     }
     // /вывод документа
     //Работа с условиями
     /*
     		$out = preg_replace('/\[tag:if_exp:?(.*)\]/u', '<?php 
     	$my_exp000=true;
     	$my_exp0001=\'$my_exp000=\'. str_replace(\'#var#\',\'$\',<<<BLOCK
     $1;
     BLOCK
     );
     	@eval($my_exp0001);
     	if($my_exp000==true)
     		{
     ?>', $out);
     		$out = str_replace('[tag:if_exp_else]', '<?php }else{ ?>', $out);
     		$out = str_replace('[tag:/if_exp]', '<?php } ?>', $out);
     */
     // Тут мы вводим в хеадер иньекцию скриптов.
     if (defined('RUB_ID')) {
         $rubheader = $AVE_DB->Query("\n\t\t\t\t\t\t\tSELECT rubric_header_template\n\t\t\t\t\t\t\tFROM " . PREFIX . "_rubrics\n\t\t\t\t\t\t\tWHERE Id = '" . RUB_ID . "'\n\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t", CACHE_LIFETIME)->GetCell();
         $out = str_replace('[tag:rubheader]', $rubheader . '[tag:rubheader]', $out);
     }
     $out = preg_replace('/\\[tag:rfld:([a-zA-Z0-9-_]+)]\\[(more|esc|img|[0-9-]+)]/e', "request_get_document_field(\"\$1\", {$id}, \"\$2\")", $out);
     // Если в запросе пришел параметр print, т.е. страница для печати, парсим контент, который обрамлен
     // тегами только для печати
     if (isset($_REQUEST['print']) && $_REQUEST['print'] == 1) {
         $out = str_replace(array('[tag:if_print]', '[/tag:if_print]'), '', $out);
         $out = preg_replace('/\\[tag:if_notprint\\](.*?)\\[\\/tag:if_notprint\\]/si', '', $out);
     } else {
         // В противном случае наоборот, парсим только тот контент, который предназначен НЕ для печати
         $out = preg_replace('/\\[tag:if_print\\](.*?)\\[\\/tag:if_print\\]/si', '', $out);
         $out = str_replace(array('[tag:if_notprint]', '[/tag:if_notprint]'), '', $out);
     }
     // получаем из шаблона системный тег, определяющий название темы дизайна
     $match = '';
     preg_match('/\\[tag:theme:(\\w+)]/', $out, $match);
     define('THEME_FOLDER', empty($match[1]) ? DEFAULT_THEME_FOLDER : $match[1]);
     $out = preg_replace('/\\[tag:theme:(.*?)]/', '', $out);
     // парсим теги модулей
     $out = $this->coreModuleTagParse($out);
     if (isset($_REQUEST['module']) && !(isset($this->install_modules[$_REQUEST['module']]) && '1' == $this->install_modules[$_REQUEST['module']]->ModuleStatus)) {
         display_notice($this->_module_error);
     }
     // парсим теги системных блоков
     $out = preg_replace_callback('/\\[tag:sysblock:([0-9-]+)\\]/', 'parse_sysblock', $out);
     // парсим теги системы внутренних запросов
     $out = preg_replace_callback('/\\[tag:request:(\\d+)\\]/', 'request_parse', $out);
     // парсим теги навигации
     $out = preg_replace_callback('/\\[tag:navigation:(\\d+):?([0-9,]*)\\]/', 'parse_navigation', $out);
     // парсим теги скрытого текста
     $out = parse_hide($out);
     // парсим остальные теги основного шаблона
     $search = array('[tag:mediapath]', '[tag:path]', '[tag:sitename]', '[tag:document]', '[tag:alias]', '[tag:home]', '[tag:robots]', '[tag:canonical]', '[tag:docid]', '[tag:breadcrumb]');
     $replace = array(ABS_PATH . 'templates/' . THEME_FOLDER . '/', ABS_PATH, htmlspecialchars(get_settings('site_name'), ENT_QUOTES), get_redirect_link('print'), @$this->curentdoc->document_alias, get_home_link(), isset($this->curentdoc->document_meta_robots) ? $this->curentdoc->document_meta_robots : '', canonical($_SERVER['REQUEST_URI']), isset($this->curentdoc->Id) ? $this->curentdoc->Id : '', get_breadcrumb());
     if (defined('MODULE_CONTENT')) {
         // парсинг тегов при выводе из модуля
         $search[] = '[tag:maincontent]';
         $replace[] = MODULE_CONTENT;
         $search[] = '[tag:title]';
         $replace[] = htmlspecialchars(defined('MODULE_SITE') ? MODULE_SITE : '', ENT_QUOTES);
         $search[] = '[tag:description]';
         $replace[] = htmlspecialchars(defined('MODULE_DESCRIPTION') ? MODULE_DESCRIPTION : '', ENT_QUOTES);
         $search[] = '[tag:keywords]';
         $replace[] = htmlspecialchars(defined('MODULE_KEYWORDS') ? MODULE_KEYWORDS : '', ENT_QUOTES);
     } else {
         $search[] = '[tag:keywords]';
         $replace[] = isset($this->curentdoc->document_meta_keywords) ? htmlspecialchars($this->curentdoc->document_meta_keywords, ENT_QUOTES) : '';
         $search[] = '[tag:description]';
         $replace[] = isset($this->curentdoc->document_meta_description) ? htmlspecialchars($this->curentdoc->document_meta_description, ENT_QUOTES) : '';
         $search[] = '[tag:title]';
         $replace[] = htmlspecialchars(pretty_chars($this->curentdoc->document_title), ENT_QUOTES);
     }
     $search[] = '[tag:maincontent]';
     $replace[] = '';
     $search[] = '[tag:printlink]';
     $replace[] = get_print_link();
     $search[] = '[tag:version]';
     $replace[] = APP_INFO;
     $search[] = '[tag:docviews]';
     $replace[] = isset($this->curentdoc->document_count_view) ? $this->curentdoc->document_count_view : '';
     // парсим тизер документа
     $out = preg_replace('/\\[tag:teaser:(\\d+)\\]/e', "showteaser(\$1)", $out);
     if (defined('RUB_ID')) {
         $out = preg_replace('/\\[tag:docauthoravatar:(\\d+)\\]/e', "getAvatar(" . intval($this->curentdoc->document_author_id) . ",\"\$1\")", $out);
     }
     if (defined('RUB_ID')) {
         $out = preg_replace('/\\[tag:lang:([a-zA-Z0-9-_]+)\\]/', '<?php if($AVE_Core->curentdoc->document_lang=="$1") { ?>', $out);
     } else {
         $out = preg_replace('/\\[tag:lang:([a-zA-Z0-9-_]+)\\]/', '<?php if($_SESSION["user_language"]=="$1") { ?>', $out);
     }
     $out = str_replace('[tag:/lang]', '<?php } ?>', $out);
     // парсим остальные теги основного шаблона
     $out = str_replace($search, $replace, $out);
     unset($search, $replace);
     // парсим теги для combine.php
     $out = preg_replace_callback('/\\[tag:(css|js):([^ :\\/]+):?(\\S+)*\\]/', array($this, '_parse_combine'), $out);
     // ЧПУ
     $out = rewrite_link($out);
     echo $out;
 }
                        $objectives = array();
                        if ($event["objectives"]) {
                            foreach ($event["objectives"] as $value) {
                                $firstpart = substr($value, 0, strlen($value) - 1);
                                $letter = substr($value, -1);
                                if (!isset($objectives[$firstpart])) {
                                    $objectives[$firstpart] = $firstpart . $letter;
                                } else {
                                    $objectives[$firstpart] .= ", " . $letter;
                                }
                            }
                        }
                        echo "<tr>\n";
                        echo "\t<td class=\"border-r\"><a href=\"" . ENTRADA_URL . "/events?id=" . $event["event_id"] . "\" target=\"_blank\">" . html_encode($event["event_title"]) . "</a></td>\n";
                        echo "\t<td class=\"border-r\">" . limit_chars($event["event_description"], 376) . "</td>\n";
                        echo "\t<td class=\"border-r\">" . $event["event_objectives"] . "</td>\n";
                        echo "\t<td class=\"border-r\">" . (!empty($event["objectives"]) ? "&rsaquo; " . implode("<br />&rsaquo; ", $objectives) : "&nbsp;") . "</td>\n";
                        echo "\t<td class=\"border-r\">" . (!empty($event["presentations"]) ? "&rsaquo; " . implode("<br />&rsaquo; ", $event["presentations"]) : "&nbsp;") . "</td>\n";
                        echo "</tr>\n";
                    }
                    ?>
					</tbody>
					</table>
					<?php 
                } else {
                    echo display_notice(array("There are no learning events in this course during the selected duration."));
                }
            }
        }
    }
}
Beispiel #13
0
 /**
  * Метод, предназначенный для обработки ошибок
  *
  * @param string $type - тип ошибки (при подключении к БД или при выполнении SQL-запроса)
  * @param string $query - текст SQL запроса вызвавшего ошибку
  * @access private
  */
 function _error($type, $query = '')
 {
     if ($type != 'query') {
         display_notice('Error ' . $type . ' MySQL database.');
     } else {
         $my_error = mysqli_error($this->_handle);
         reportLog('SQL ERROR: ' . $my_error . PHP_EOL . "\t\tQUERY: " . stripslashes($query) . PHP_EOL . "\t\t" . $this->get_caller() . PHP_EOL . "\t\tURL: " . HOST . $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'] . PHP_EOL);
         // Если в настройках системы установлен параметр на отправку сообщений на e-mail, тогда
         if (SEND_SQL_ERROR) {
             // Формируем текст сообщения с ошибкой
             $mail_body = 'SQL ERROR: ' . $my_error . PHP_EOL . 'TIME: ' . date('d-m-Y, H:i:s') . PHP_EOL . 'URL: ' . HOST . $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'] . PHP_EOL . $this->get_caller() . PHP_EOL . 'QUERY: ' . stripslashes($query) . PHP_EOL;
             // Отправляем сообщение
             send_mail(get_settings('mail_from'), $mail_body, 'MySQL Error!', get_settings('mail_from'), get_settings('mail_from_name'), 'text');
         }
     }
 }
                        foreach ($results as $result) {
                            echo "<tr>\n";
                            echo "\t<td><input type=\"checkbox\" name=\"admin_proxy_ids[]\" value=\"" . (int) $result["proxy_id"] . "\"" . ($result["proxy_id"] == $ENTRADA_USER->getActiveId() ? " onclick=\"this.checked = false\" disabled=\"disabled\"" : "") . " /></td>\n";
                            echo "\t<td>" . date(DEFAULT_DATE_FORMAT, $result["member_joined"]) . "</td>\n";
                            echo "\t<td><a href=\"" . ENTRADA_URL . "/people?profile=" . html_encode($result["username"]) . "\"" . ($result["proxy_id"] == $ENTRADA_USER->getActiveId() ? " style=\"font-weight: bold" : "") . "\">" . html_encode($result["firstname"] . " " . $result["lastname"]) . "</a></td>\n";
                            echo "\t<td class=\"list-status\"><img src=\"images/" . ($MAILING_LISTS["active"] && $mail_list->users[$result["proxy_id"]]["member_active"] ? "list-status-online.gif\" alt=\"Active\"" : "list-status-offline.gif\" alt=\"Disabled\"") . " /></td>\n";
                            echo "</tr>\n";
                        }
                        ?>
				</tbody>
			</table>
		</form>
		</div><!--/row-fluid-->
							<?php 
                    } else {
                        echo display_notice(array("Your community has no administrators at this time; the MEdTech Unit has been informed of this error, please try again later."));
                        application_log("error", "Someone [" . $ENTRADA_USER->getID() . "] accessed the Manage Members page in a community [" . $COMMUNITY_ID . "] with no administrators present.");
                    }
                    ?>
	</div>
	<div class="tab-page members">
		<h3 class="tab">Add Members</h3>
		<h2 style="margin-top: 0px">Add Members</h2>
		<form action="<?php 
                    echo ENTRADA_URL . "/" . $MODULE . "?" . replace_query(array("section" => "members", "type" => "add", "step" => 2));
                    ?>
" method="post" class="form-horizontal">
		<div class="row-fluid">
			<p>If you would like to add users that already exist in the system to this community yourself, you can do so by clicking the checkbox beside their name from the list below.
									Once you have reviewed the list at the bottom and are ready, click the <strong>Proceed</strong> button at the bottom to complete the process.</p>
		</div>
Beispiel #15
0
                        echo "<table width=\"100%\">\n";
                        echo "\t<thead>\n";
                        echo "\t\t<tr>\n";
                        echo "\t\t\t<th width=\"40%\" style=\"text-align:left;\">Assessment Title</th>\n";
                        echo "\t\t\t<th width=\"20%\" style=\"text-align:left;\">Type</th>\n";
                        echo "\t\t\t<th width=\"25%\" style=\"text-align:left;\">Characteristic</th>\n";
                        echo "\t\t\t<th width=\"15%\" style=\"text-align:left;\">Grade Weight</th>\n";
                        echo "\t\t</tr>\n";
                        echo "\t</thead>\n";
                        echo "\t<tbody>\n";
                        foreach ($course["assessments"] as $assessment) {
                            echo "\t<tr>\n";
                            echo "\t\t<td>" . $assessment["name"] . "</td>\n";
                            echo "\t\t<td>" . $assessment["type"] . "</td>\n";
                            echo "\t\t<td>" . $assessment["characteristic"] . "</td>\n";
                            echo "\t\t<td>" . $assessment["grade_weighting"] . "</td>\n";
                            echo "\t</tr>\n";
                        }
                        echo "\t<tbody>\n";
                        echo "</table>\n";
                    }
                }
                break;
            default:
                continue;
                break;
        }
    }
} else {
    echo display_notice(array("Please <a href=\"" . ENTRADA_URL . "/?url=" . rawurlencode($PROCEED_TO) . "\">log into " . APPLICATION_NAME . "</a> to access more content on this page."));
}
                }
            } else {
                add_error("We were unable to deactive the requested reports from the system. The system administrator has been informed of this issue and will address it shortly; please try again later.");
                echo display_error();
                application_log("error", "Failed to execute deactivate query for raci_ids: " . implode(", ", $report_ids) . ". Database said: " . $db->ErrorMsg());
            }
            break;
        case 1:
        default:
            if ($ERROR) {
                echo display_error();
            }
            $query = "SELECT * FROM `reports_aamc_ci` WHERE `raci_id` IN (" . implode(", ", $report_ids) . ") AND `report_active` = '1' ORDER BY `report_date` DESC";
            $results = $db->GetAll($query);
            if ($results) {
                echo display_notice(array("Please review the following AAMC Curriculum Inventory reports to ensure that you wish to deactivate them. A system administrator can recover removed reports at a later time if required."));
                ?>
				<form action="<?php 
                echo ENTRADA_URL;
                ?>
/admin/reports/aamc?section=delete&amp;step=2" method="post">
				<table class="tableList" cellspacing="0" summary="List of AAMC Curriculum Inventory Reports">
					<colgroup>
						<col class="modified" />
						<col class="date" />
						<col class="title" />
						<col class="general" />
					</colgroup>
					<thead>
						<tr>
							<td class="modified">&nbsp;</td>
                $url = ENTRADA_URL . "/admin/settings/manage/objectives?org=" . $ORGANISATION_ID;
                $SUCCESS++;
                $SUCCESSSTR[] = "You have successfully deactivated " . $success_count . " objectives from the system." . ($moved_count && $deleted_count ? " <br /><br />Additionally, " . $moved_count . " of these objectives' children were placed under a new parent and " . $deleted_count . " of the objectives' children were deactivated along with their parent objective." : ($moved_count && !$deleted_count ? " <br /><br />Additionally, " . $moved_count . " of these objectives' children were placed under a new parent." : ($deleted_count ? " <br /><br />Additionally, " . $deleted_count . " of these objectives' children were deactivated along with under a new parent." : ""))) . "<br /><br />You will now be redirected to the index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
                $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
                application_log("success", "Objectives successfully deactivated in the system.");
            }
            if ($SUCCESS) {
                echo display_success();
            }
            break;
        case 1:
        default:
            if ($ERROR) {
                echo display_error();
            } else {
                echo display_notice(array("Please review the following objective or objectives to ensure that you wish to permanently delete them."));
                $HEAD[] = "\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\tfunction selectObjective(parent_id, objective_id, excluded_objectives) {\n\t\t\t\t\t\t\t\t\tnew Ajax.Updater('selectParent'+objective_id+'Field', '" . ENTRADA_URL . "/api/objectives-list.api.php', {parameters: {'pid': parent_id, 'id': objective_id, 'excluded': excluded_objectives}});\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfunction selectOrder(parent_id, objective_id) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</script>";
                ?>
				<form action="<?php 
                echo ENTRADA_URL . "/admin/settings/manage/objectives?" . replace_query(array("action" => "delete", "step" => 2));
                ?>
" method="post">
				<table class="tableList" cellspacing="0" summary="List of objectives to be removed">
				<colgroup>
					<col class="modified" />
					<col class="title" />
				</colgroup>
				<thead>
					<tr>
						<td class="modified">&nbsp;</td>
						<td class="title">Objectives</td>
Beispiel #18
0
            echo "\t<td class=\"actions\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . ($result["event_type"] == "elective" ? "Elective (Approved)" : "Core Rotation") . "</a></td>\n";
            echo "\t<td class=\"title\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . html_encode($result["rotation_title"]) . "</a></td>\n";
            echo "\t<td class=\"actions\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . html_encode($result["region_name"]) . "</a></td>\n";
            echo "\t<td class=\"actions\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . date("M d/y", $result["event_start"]) . "</a></td>\n";
            echo "\t<td class=\"actions\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . date("M d/y", $result["event_finish"]) . "</a></td>\n";
            echo "</tr>\n";
        }
        ?>
				</tbody>
			</table>
		</form>
		<?php 
    } else {
        $NOTICE++;
        $NOTICESTR[] = "There are no learners that require accommodations in the system at this time.";
        echo display_notice($NOTICESTR);
    }
    ?>
	</div>

	<?php 
    $query = "\tSELECT a.*, b.`apartment_title`, c.`region_name`, d.`id` AS `proxy_id`, d.`firstname`, d.`lastname`, e.`group` AS `learner_type`\n\t\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`apartment_schedule` AS a\n\t\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`apartments` AS b\n\t\t\t\tON b.`apartment_id` = a.`apartment_id`\n\t\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`regions` AS c\n\t\t\t\tON c.`region_id` = b.`region_id`\n\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_data` AS d\n\t\t\t\tON d.`id` = a.`proxy_id`\n\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS e\n\t\t\t\tON e.`user_id` = d.`id`\n\t\t\t\tAND e.`group` IN ('student', 'Clerk', 'Resident')\n\t\t\t\tAND e.`account_active` = 'true'\n\t\t\t\tAND e.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\tWHERE a.`confirmed` = '0'\n\t\t\t\tAND a.`inhabiting_finish` > UNIX_TIMESTAMP()\n\t\t\t\tGROUP BY d.`id`\n\t\t\t\tORDER BY a.`inhabiting_start` ASC";
    $results = $db->GetAll($query);
    if ($results) {
        ?>
		<h2 title="Unconfirmed Accommodation Assignments">Unconfirmed Accommodation Assignments</h2>

		<div id="unconfirmed-accommodation-assignments">
			<div class="display-generic">
				The following list of learners have been assigned accommodations but have not yet confirmed the assignment.
			</div>
                echo display_error();
            }
            break;
        case 1:
        default:
            if ($NOTICE) {
                echo display_notice();
            }
            if ($ERROR) {
                echo display_error();
            }
            if (count($PROXY_IDS)) {
                $query = "\n\t\t\t\t\t\t\tSELECT a.*, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`, b.`account_active`, b.`access_starts`, b.`access_expires`, b.`last_login`, b.`role`, b.`group`\n\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\tWHERE b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\tAND a.id IN (" . implode(", ", $PROXY_IDS) . ")\n\t\t\t\t\t\t\tORDER BY `fullname` ASC";
                $results = $db->GetAll($query);
                if ($results) {
                    echo display_notice(array("Please review the following users to ensure that you wish to remove their access from this system."));
                    ?>
					<form action="<?php 
                    echo ENTRADA_URL;
                    ?>
/admin/users?section=delete&amp;step=2" method="post">
						<table class="tableList" cellspacing="0" summary="List of Users To Delete">
							<colgroup>
								<col class="modified" />
								<col class="title" />
								<col class="general" />
								<col class="general" />
								<col class="date" />
							</colgroup>
							<thead>
								<tr>
Beispiel #20
0
 /**
  * Creates tables for the module implementing the class.
  * If you override this function make sure that your code can handles table creation.
  *
  */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->db->createTable($this);
             if ($this->bean_implements('ACL')) {
                 $aclList = SugarACL::loadACLs($this->getACLCategory());
                 foreach ($aclList as $acl) {
                     if ($acl instanceof SugarACLStatic) {
                         $createACL = true;
                     }
                 }
             }
             if (!empty($createACL)) {
                 if (!empty($this->acltype)) {
                     ACLAction::addActions($this->getACLCategory(), $this->acltype);
                 } else {
                     ACLAction::addActions($this->getACLCategory());
                 }
             }
         } else {
             display_notice("Table already exists : {$this->table_name}<br>");
         }
         if ($this->is_AuditEnabled()) {
             if (!$this->db->tableExists($this->get_audit_table_name())) {
                 $this->create_audit_table();
             }
         }
     }
 }
            } else {
                $ERROR++;
                $ERRORSTR[] = "We were unable to remove the requested courses from the system. The MEdTech Unit has been informed of this issue and will address it shortly; please try again later.";
                echo display_error();
                application_log("error", "Failed to remove course ids: " . implode(", ", $COURSE_IDS) . ". Database said: " . $db->ErrorMsg());
            }
            break;
        case 1:
        default:
            if ($ERROR) {
                echo display_error();
            } else {
                $query = "\tSELECT a.`course_id`, a.`course_name`, a.`course_url`, CONCAT_WS(', ', c.`lastname`, c.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\tFROM `courses` AS a\n\t\t\t\t\t\t\t\tLEFT JOIN `course_contacts` AS b\n\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\tAND b.`contact_type` = 'director'\n\t\t\t\t\t\t\t\tAND b.`contact_order` = '0'\n\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_data` AS c\n\t\t\t\t\t\t\t\tON c.`id` = b.`proxy_id`\n\t\t\t\t\t\t\t\tWHERE a.`course_id` IN (" . implode(", ", $COURSE_IDS) . ")\n\t\t\t\t\t\t\t\tAND a.`course_active` = '1'\n\t\t\t\t\t\t\t\tGROUP BY a.`course_id`\n\t\t\t\t\t\t\t\tORDER BY a.`course_name` ASC";
                $results = $db->GetAll($query);
                if ($results) {
                    echo display_notice(array("Please review the following course" . (count($COURSE_IDS) != 1 ? "s" : "") . " to ensure that you wish to <strong>permanently delete</strong> " . (count($COURSE_IDS) != 1 ? "them" : "it") . " and <strong>unlink any events</strong> currently associated to " . (count($COURSE_IDS) != 1 ? "these courses" : "this course") . ".<br /><br /><strong>Important:</strong> If you remove " . (count($COURSE_IDS) != 1 ? "these courses" : "this course") . " all associated events will be disassociated with a course."));
                    ?>
					<form action="<?php 
                    echo ENTRADA_URL;
                    ?>
/admin/<?php 
                    echo $MODULE;
                    ?>
?section=delete&amp;step=2" method="post">
					<table class="tableList" cellspacing="0" summary="List of Courses">
					<colgroup>
						<col class="modified" />
						<col class="title" />
						<col class="teacher" />
						<col class="general" />
						<col class="attachment" />
                                        $PROCESSED["associated_proxy_ids"][] = $proxy_id;
                                    }
                                }
                            }
                        }
                    }
                }
                $students = $organisation;
                $query = "\tSELECT a.`id` AS `proxy_id`, b.`organisation_id`, b.`role`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\tJOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\tWHERE b.`app_id` IN (" . AUTH_APP_IDS_STRING . ")\n\t\t\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\tAND b.`group` = 'student'\n\t\t\t\t\t\t\tAND a.`grad_year` >= " . $db->qstr(fetch_first_year() - 4) . ($ENTRADA_USER->getActiveGroup() == "student" ? " AND a.`id` = " . $db->qstr($ENTRADA_USER->getID()) : "") . "\n\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\tORDER BY a.`grad_year` DESC, a.`lastname` ASC, a.`firstname` ASC";
                $student_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                if ($student_results) {
                    foreach ($student_results as $student) {
                        if (isset($PROCESSED["associated_proxy_ids"]) && is_array($PROCESSED["associated_proxy_ids"]) && in_array($student["proxy_id"], $PROCESSED["associated_proxy_ids"])) {
                            $checked = "checked=\"checked\"";
                        } else {
                            $checked = "";
                        }
                        $students[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $student["fullname"], "value" => "student_" . $student["proxy_id"], "checked" => $checked);
                    }
                    echo lp_multiple_select_popup("students", $students, array("title" => "Select Individual Learners:", "submit_text" => "Close", "submit" => true));
                } else {
                    echo display_notice("There are no students available.");
                }
                break;
            default:
                application_log("notice", "Unknown learning event filter type [" . $options_for . "] provided to events_filters API.");
                break;
        }
    }
}
exit;
            } else {
                $ERROR++;
                $ERRORSTR[] = "We were unable to remove the requested notices from the system. The MEdTech Unit has been informed of this issue and will address it shortly; please try again later.";
                echo display_error();
                application_log("error", "Failed to execute remove query for notice ids: " . implode(", ", $NOTICE_IDS) . ". Database said: " . $db->ErrorMsg());
            }
            break;
        case 1:
        default:
            if ($ERROR) {
                echo display_error();
            }
            $query = "  SELECT a.*, CONCAT(b.`firstname`, ' ', b.`lastname`) AS notice_author \n\t\t\t\t\t\t FROM `notices` AS a\n\t\t\t\t\t\t JOIN `" . AUTH_DATABASE . "`.`user_data` AS b\n\t\t\t\t\t\t ON a.`created_by` = b.`id`\n\t\t\t\t\t\t WHERE `notice_id` IN (" . implode(", ", $NOTICE_IDS) . ") ORDER BY `display_until` ASC";
            $results = $db->GetAll($query);
            if ($results) {
                echo display_notice(array("Please review the following notices to ensure that you wish to permanently delete them. This action cannot be undone."));
                ?>
				<script type="text/javascript">
					jQuery(document).ready(function () {
						jQuery("#delete-notices").on("click", function (event) {
							var checked = document.querySelectorAll("input.delete-control:checked").length === 0 ? false : true;
							if (!checked) {
								event.preventDefault();
								var errors = new Array();
								errors[0] = "You must select at least 1 notice to delete by checking the checkbox to the left the notice.";
								display_error(errors, "#msg");
							}
						});
					});
				</script>
				<div id="msg"></div>
									<td>Assessment Description</td>
								</tr>
							</thead>
							<tbody>
							<?php 
                            foreach ($result as $assessment) {
                                echo "<tr class=\"border-l\">\n";
                                echo "\t<td class=\"border-r\"><a href=\"" . ENTRADA_URL . "/admin/gradebook/assessments?section=grade&id=" . $course_id . "&assessment_id=" . $assessment["assessment_id"] . "\">" . $assessment["name"] . "</a></td>";
                                echo "\t<td class=\"border-r\">" . $assessment["description"] . "</td>";
                                echo "</tr>";
                            }
                            ?>
							</tbody>
							</table>
							<?php 
                        } else {
                            $empty_criteria .= $type_criteria[$result_id] . "<br />";
                        }
                    }
                    if (!empty($empty_criteria)) {
                        echo display_notice(array("There are no assessments in this course which match the criteria:<br />" . $empty_criteria));
                    }
                } else {
                    echo display_notice(array("There are no assessments in this course which match the criteria."));
                }
            }
        } else {
            echo display_notice(array("There were no courses chosen."));
        }
    }
}
                        $labTotals = $labTotals + $outputTotals["lab_hours"];
                        $sgTotals = $sgTotals + $outputTotals["small_group_hours"];
                        $pcsTotals = $pcsTotals + $outputTotals["patient_contact_session_hours"];
                        $sympTotals = $sympTotals + $outputTotals["symposium_hours"];
                        $dirTotals = $dirTotals + $outputTotals["directed_independant_learning_hours"];
                        $revTotals = $revTotals + $outputTotals["review_feedback_session_hours"];
                        $examTotals = $examTotals + $outputTotals["examination_hours"];
                        $clerkTotals = $clerkTotals + $outputTotals["clerkship_seminar_hours"];
                        $otherTotals = $otherTotals + $outputTotals["other_hours"];
                    }
                    echo "\t<tr><td style=\"width: 3%; font-weight: bold\">Totals:</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($lectureTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($labTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($sgTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($pcsTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($sympTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($dirTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($revTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($examTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($clerkTotals, 2) . "</td>\n";
                    echo "\t<td style=\"width: 1%; font-weight: bold\">" . number_format($otherTotals, 2) . "</td></tr>";
                    echo "</tbody></table>";
                } else {
                    echo display_notice(array("There are no records in the system for the qualifiers you have selected."));
                }
            }
        } else {
            echo display_notice(array("There are no annual reports in the system yet."));
        }
    }
}
    if (file_exists(ANNUALREPORT_STORAGE . "/" . $FILE)) {
        $filesize = filesize(ANNUALREPORT_STORAGE . "/" . $FILE);
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/pdf");
        header("Content-Disposition: attachment; filename=\"" . $FILE . "\"");
        header("Content-Length: " . $filesize);
        header("Content-Transfer-Encoding: binary");
        echo file_get_contents(ANNUALREPORT_STORAGE . "/" . $FILE, FILE_BINARY);
        $extension = explode(".", $FILE);
        $extension = $extension["1"];
        // delete the files (PDF and HTML or TXT).
        unlink(ANNUALREPORT_STORAGE . "/" . $FILE);
        if ($extension == "pdf") {
            $FILE = str_replace(".pdf", ".html", $FILE);
            unlink(ANNUALREPORT_STORAGE . "/" . $FILE);
        }
        exit;
    } else {
        $TITLE = "Not Found";
        $BODY = display_notice(array("The file that you are trying to download (<strong>" . html_encode($result["file_name"]) . "</strong>) does not exist in the filesystem.<br /><br />Please contact a system administrator or a teacher listed on the <a href=\"" . ENTRADA_URL . "/events?id=" . $result["event_id"] . "\" style=\"font-weight: bold\">event page</a>."));
        $template_html = fetch_template("global/external");
        if ($template_html) {
            echo str_replace(array("%DEFAULT_CHARSET%", "%ENTRADA_URL%", "%TITLE%", "%BODY%"), array(DEFAULT_CHARSET, ENTRADA_URL, $TITLE, $BODY), $template_html);
        }
        exit;
    }
}
                        echo "\t<td>" . $evaluation_evaluator["fullname"] . "</td>\n";
                        echo "\t<td>" . $target_name . "</td>\n";
                        echo "\t<td>Not yet begun</td>\n";
                        echo "\t<td>" . date(DEFAULT_DATE_FORMAT, $evaluation_evaluator["updated_date"]) . "</td>\n";
                        echo "</tr>\n";
                    }
                }
                ?>
	                </tbody>
	                <tfoot>
	                    <tr><td>&nbsp;</td></tr>
	                </tfoot>
	                </table>
	                <?php 
            } else {
                echo display_notice(array("There are no evaluators who have not started this evaluation."));
            }
        }
        ?>
		</div>
		<br /><br />
		<?php 
        /**
         * Sidebar item that will provide a method for choosing which results to display.
         */
        $sidebar_html = "Display progress as a:\n";
        $sidebar_html .= "<ul class=\"menu\">\n";
        $sidebar_html .= "\t<li class=\"" . ($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["display"] == false ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("display" => "summary")) . "\" title=\"Summary\">summary</a></li>\n";
        $sidebar_html .= "\t<li class=\"" . ($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["display"] == true ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("display" => "complete_list")) . "\" title=\"Complete list\">complete list of attempts</a></li>\n";
        $sidebar_html .= "</ul>\n";
        new_sidebar_item("Progress Display", $sidebar_html, "sort-results", "open");
Beispiel #28
0
	<table class="tableList" cellspacing="0" cellpadding="1" border="0" summary="List of Organisations">
		<colgroup>
			<col class="modified"/>
			<col class="title" />
			<col class="active" />
		</colgroup>
		<thead>
			<tr>
				<td class="modified">&nbsp;</td>
				<td class="title" width="650">Department</td>
			</tr>
		</thead>
		<tbody>
			<?php 
        foreach ($results as $result) {
            echo "<tr><td><input type=\"checkbox\" name = \"remove_ids[]\" value=\"" . $result["department_id"] . "\"/></td>";
            echo "<td><a href=\"" . ENTRADA_URL . "/admin/settings/manage/departments?section=edit&amp;org=" . $ORGANISATION_ID . "&amp;department_id=" . $result["department_id"] . "\">" . $result["department_title"] . "</a></td></tr>";
        }
        ?>
		</tbody>
	</table>
	<br />
	<input type="submit" class="btn btn-danger" value="Delete Selected" />
	</form>
	<?php 
    } else {
        $NOTICE++;
        $NOTICESTR[] = "There are currently no Departments assigned to this Organisation";
        echo "<br />" . display_notice();
    }
}
} else {
    if ($router && $router->initRoute()) {
        if (isset($_GET["id"]) && ($tmp_input = clean_input($_GET["id"], "int"))) {
            $REPORT_ID = $tmp_input;
        }
        if ($REPORT_ID) {
            $query = "SELECT * FROM `reports_aamc_ci` WHERE `raci_id` = " . $db->qstr($REPORT_ID) . " AND `organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation());
            $REPORT = $db->GetRow($query);
            if ($REPORT) {
                $SHORT_REPORT_TITLE = date("Y", $REPORT["report_start"]) . "-" . date("Y", $REPORT["report_finish"]) . " Curriculum";
                $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/reports/aamc/manage?id=" . $REPORT_ID, "title" => $SHORT_REPORT_TITLE);
                $sidebar_html = "<ul class=\"menu\">";
                $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/reports/aamc/manage/edit?id=" . $REPORT_ID . "\">Edit Report</a></li>\n";
                $sidebar_html .= "</ul>";
                new_sidebar_item($SHORT_REPORT_TITLE, $sidebar_html, "aamc-report", "open");
                $module_file = $router->getRoute();
                if ($module_file) {
                    require_once $module_file;
                }
            } else {
                add_notice("You don't appear to have access to change this organisation. If you feel you are seeing this in error, please contact your system administrator.");
                echo display_notice();
            }
        }
    } else {
        $url = ENTRADA_URL . "/admin/" . $MODULE;
        application_log("error", "The Entrada_Router failed to load a request. The user was redirected to [" . $url . "].");
        header("Location: " . $url);
        exit;
    }
}
            if ($ERROR) {
                echo display_error();
            }
            break;
        case 1:
        default:
            if ($ERROR) {
                echo display_error();
            } else {
                $total_events = count($draft_ids);
                $drafts = array();
                foreach ($draft_ids as $draft_id) {
                    $drafts[] = Models_Event_Draft::fetchRowByID($draft_id);
                }
                if (!empty($drafts)) {
                    echo display_notice(array("Please review the following draft" . ($total_events > 1 ? "s" : "") . " to ensure that you wish to set " . ($total_events > 1 ? "them" : "it") . " to <strong>" . $status . "</strong>.<br /><br />Approving a draft will schedule it to be imported into the system.<br />Re-opening a draft will remove it from the importation schedule and allow it to be modified."));
                    $JQUERY[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/jquery/jquery.dataTables.min.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>\n";
                    ?>
					<style type="text/css">
						#draft-list_length {padding:5px 4px 0 0;}
						#draft-list_filter {-moz-border-radius:10px 10px 0px 0px; border: 1px solid #9D9D9D;border-bottom:none;background-color:#FAFAFA;font-size: 0.9em;padding:3px;}
						#draft-list_paginate a {margin:2px 5px;}
					</style>
					<form action="<?php 
                    echo ENTRADA_URL;
                    ?>
/admin/events/drafts?section=status&step=2&action=<?php 
                    echo $action;
                    ?>
" method="post">
                        <table class="table table-bordered table-striped" id="draft-list" widht="100%" cellspacing="0" summary="List of Events">