本文整理汇总了PHP中Student::get_iterated方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::get_iterated方法的具体用法?PHP Student::get_iterated怎么用?PHP Student::get_iterated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::get_iterated方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_files_to_zip_archive
/**
* Add files to open zip archive.
* @param ZipArchive $zip_archive open zip archive.
* @param Course $course course object with loaded course.
* @param string|NULL $subdirectory subdirectory where to add files.
*/
public function add_files_to_zip_archive(ZipArchive $zip_archive, Course $course, $subdirectory = NULL)
{
if (!is_null($this->id)) {
ini_set('max_execution_time', 300);
$path_to_task_set_files = 'private/uploads/solutions/task_set_' . $this->id . '/';
if (file_exists($path_to_task_set_files)) {
$groups = $course->groups->get_iterated();
$group_names = array(0 => 'unassigned');
foreach ($groups as $group) {
$group_names[$group->id] = normalizeForFilesystem($this->lang->text($group->name));
}
$students = new Student();
$students->include_related('participant');
$students->where_related('participant/course', $course);
$students->get_iterated();
$student_groups = array();
foreach ($students as $studnet) {
$student_groups[$studnet->id] = intval($studnet->participant_group_id);
}
$files = scandir($path_to_task_set_files);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if (preg_match(self::STUDENT_FILE_NAME_REGEXP, $file, $matches)) {
$student_id = intval($matches['student_id']);
$path = ($subdirectory !== NULL && trim($subdirectory) != '' ? $subdirectory . '/' : '') . $group_names[$student_groups[$student_id]] . '/' . $file;
$zip_archive->addFile($path_to_task_set_files . $file, $path);
}
}
}
}
}
}
示例2: group_mail
public function group_mail($group_id)
{
$group = new Group();
$group->include_related('course', 'name');
$group->include_related('course/period', 'name');
$group->get_by_id($group_id);
$students = new Student();
$students->where_related('participant/group', 'id', $group->id);
$students->where_related('participant/course', 'id', $group->course_id);
$students->where_related('participant', 'allowed', 1);
$students->get_iterated();
$this->_add_tinymce4();
$this->parser->add_js_file('admin_groups/group_mail.js');
$this->parser->parse('backend/groups/group_mail.tpl', array('group' => $group, 'students' => $students));
}
示例3: get_all_students
public function get_all_students()
{
$this->output->set_content_type('application/json');
$students = new Student();
$students->order_by('fullname', 'asc');
$students->or_like('fullname', trim($this->input->get('term')));
$students->or_like('email', trim($this->input->get('term')));
$students->get_iterated();
$data = array();
foreach ($students as $student) {
$data[] = array('value' => $student->fullname . ' (' . $student->email . ')', 'id' => $student->id);
}
$this->output->set_output(json_encode($data));
}
示例4: get_valuation_table_data
private function get_valuation_table_data($course_id, $group_id = NULL, $condensed = FALSE)
{
$table_data = array('header' => array(), 'content' => array());
$course = new Course();
$course->get_by_id(intval($course_id));
$group = new Group();
$group->get_by_id((int) $group_id);
if ($course->exists()) {
$students = new Student();
$students->select('id, fullname, email');
$students->include_related('participant/group', array('id', 'name'));
$students->where_related('participant/course', 'id', $course->id);
$students->where_related('participant', 'allowed', 1);
$students->order_by_as_fullname('fullname');
if ($group->exists()) {
$students->where_related('participant/group', 'id', (int) $group_id);
}
$students->get_iterated();
$task_sets_out_of_group_ids = array(0);
$task_sets_data = array();
$task_sets_ids = array();
$projects_ids = array();
if ($group->exists()) {
$students_filter = new Student();
$students_filter->select('id');
$students_filter->where_related('participant/course', 'id', $course->id);
$students_filter->where_related('participant', 'allowed', 1);
$students_filter->where_related('participant/group', 'id', (int) $group->id);
$solutions_filter = new Solution();
$solutions_filter->select('id');
$solutions_filter->where_in_subquery('student_id', $students_filter);
$task_sets_out_of_group = new Task_set();
$task_sets_out_of_group->select('id');
$task_sets_out_of_group->where_in_subquery('id', $solutions_filter);
$task_sets_out_of_group->where('published', 1);
$task_sets_out_of_group->get();
$task_sets_out_of_group_ids = $task_sets_out_of_group->all_to_single_array('id');
$task_sets_out_of_group_ids[] = 0;
}
$content_type_task_set = new Task_set();
$content_type_task_set->select('id, name, content_type, group_id, task_set_type_id');
$content_type_task_set->include_related('task_set_type', 'name');
$content_type_task_set->include_related('group', 'name');
$content_type_task_set->where('content_type', 'task_set');
$content_type_task_set->where('published', 1);
$content_type_task_set->where_related_course($course);
$content_type_task_set->order_by_related_with_constant('task_set_type', 'name', 'asc');
$content_type_task_set->order_by('task_set_type_id', 'asc');
$content_type_task_set->order_by('publish_start_time', 'asc');
if ($group->exists()) {
$content_type_task_set->group_start();
$content_type_task_set->group_start('', 'OR ');
$content_type_task_set->group_start();
$content_type_task_set->or_where('group_id', NULL);
$content_type_task_set->or_where('group_id', (int) $group_id);
$content_type_task_set->group_end();
$content_type_task_set->where_subquery(0, '(SELECT COUNT(`tsp`.`id`) AS `count` FROM `task_set_permissions` tsp WHERE `tsp`.`task_set_id` = `task_sets`.`id` AND `tsp`.`enabled` = 1)');
$content_type_task_set->group_end();
$content_type_task_set->group_start('', 'OR ');
$content_type_task_set->where_related('task_set_permission', 'group_id', (int) $group_id);
$content_type_task_set->where_related('task_set_permission', 'enabled', 1);
$content_type_task_set->group_end();
$content_type_task_set->or_where_in('id', $task_sets_out_of_group_ids);
$content_type_task_set->group_end();
}
$content_type_task_set->get();
$header_items = array();
if ($content_type_task_set->result_count() > 0) {
$last_task_set_type_id = NULL;
foreach ($content_type_task_set->all as $task_set) {
$permissions = new Task_set_permission();
$permissions->select('id, group_id');
$permissions->include_related('group', 'name');
$permissions->where_related_task_set($task_set);
$permissions->where('enabled', 1);
$permissions->get_iterated();
if ($permissions->result_count() > 0) {
$group_ids = array();
$group_names = array();
foreach ($permissions as $permission) {
$group_ids[] = $permission->group_id;
$group_names[] = $this->lang->text($permission->group_name);
}
$task_sets_data[$task_set->id] = array('group_id' => $group_ids, 'group_name' => $group_names);
} else {
$task_sets_data[$task_set->id] = array('group_id' => array($task_set->group_id), 'group_name' => $this->lang->text($task_set->group_name));
}
if ($task_set->task_set_type_id !== $last_task_set_type_id) {
$last_task_set_type_id = $task_set->task_set_type_id;
$header_items[] = array('type' => 'task_set_type', 'id' => $task_set->task_set_type_id, 'name' => $this->lang->text($task_set->task_set_type_name), 'title' => '');
}
if (!$condensed) {
$header_items[] = array('type' => 'task_set', 'id' => $task_set->id, 'name' => $this->lang->get_overlay_with_default('task_sets', $task_set->id, 'name', $task_set->name), 'title' => is_array($task_sets_data[$task_set->id]['group_name']) ? implode(', ', $task_sets_data[$task_set->id]['group_name']) : $task_sets_data[$task_set->id]['group_name']);
}
$task_sets_ids[] = $task_set->id;
}
}
$table_data['header']['content_type_task_set'] = array('content_type_name' => $this->lang->line('admin_solutions_valuation_tables_header_content_type_task_sets'), 'items' => $header_items);
$content_type_project = new Task_set();
$content_type_project->where('content_type', 'project');
//.........这里部分代码省略.........
示例5: inject_students
private function inject_students()
{
$students = new Student();
$students->order_by_as_fullname('fullname');
$students->get_iterated();
$data = array();
foreach ($students as $student) {
$data[$student->id] = $student->fullname . ' (' . $student->email . ')';
}
$this->parser->assign('students', $data);
}
示例6: task
public function task($task_set_id_url = NULL, $task_id_url = NULL)
{
$this->_add_mathjax();
$task_set_id = url_get_id($task_set_id_url);
$task_id = url_get_id($task_id_url);
$this->_initialize_student_menu();
$this->_select_student_menu_pagetag('projects');
$this->parser->add_css_file('frontend_projects.css');
$this->parser->add_js_file('projects/task.js');
$this->_add_prettify();
$this->_add_jquery_countdown();
$this->parser->assign('max_filesize', compute_size_with_unit(intval($this->config->item('maximum_solition_filesize') * 1024)));
$cache_id = $this->usermanager->get_student_cache_id('task_set_' . $task_set_id . '|task_' . $task_id);
if (!$this->_is_cache_enabled() || !$this->parser->isCached($this->parser->find_view('frontend/projects/task.tpl'), $cache_id)) {
$project_all = $this->get_task_set($task_set_id, $course, $student);
$project = $this->filter_valid_task_sets($project_all);
if ($course->exists()) {
$this->lang->init_overlays('task_sets', $project, array('name'));
$project = count($project) == 1 ? $project[0] : new Task_set();
$this->parser->assign('project', $project);
$task = $project->task;
$task->include_join_fields()->order_by('`task_task_set_rel`.`sorting`', 'asc');
$task->get_by_id($task_id);
$project_selection = new Project_selection();
$project_selection->where('task_set_id', $project->id);
$project_selection->where('student_id', $this->usermanager->get_student_id());
$project_selection->where('task_id', $task->id);
$project_selection->get();
$students = new Student();
$students->where_related('project_selection', 'task_set_id', $project->id);
$students->where_related('project_selection', 'task_id', $task->id);
$students->get_iterated();
$solution_versions = new Solution_version();
$solution_versions->where_related('solution/task_set', 'id', $task_set_id);
$solution_versions->where_related('solution', 'student_id', $this->usermanager->get_student_id());
$query = $solution_versions->get_raw();
$versions_metadata = array();
if ($query->num_rows()) {
foreach ($query->result() as $row) {
$versions_metadata[$row->version] = clone $row;
}
}
$query->free_result();
$this->parser->assign('task', $task);
$this->parser->assign('students', $students);
$this->parser->assign('project_selection', $project_selection);
$this->parser->assign('solution_files', $project->get_student_files($student->id));
$this->parser->assign('versions_metadata', $versions_metadata);
}
$this->parser->assign(array('course' => $course));
}
$this->parser->parse('frontend/projects/task.tpl', array(), FALSE, $this->_is_cache_enabled(), $cache_id);
}