function section_activities($secid,$cid){ $course=get_course($cid); $modinfo = get_fast_modinfo($course); $mods = $modinfo->get_cms(); $sections = $modinfo->get_section_info_all(); $sec_array = get_sections($sections); $arr = array(); $cnt=0; //preparing an array which contains sections and activities foreach ($mods as $mod) { $arr[$cnt++]=array('secid'=>$mod->section,'modid'=>$mod->id,'modname'=>$mod->name,'modcontent'=>$mod->content); //print_r($mod->name); } //returns the all activities associated to perticular section in a course function get_activities($sectionid,$arr) { $cnt=0; $sec_activity_array = array(); for($i=0;$i<count($arr);$i++) { if($arr[$i]['secid']==$sectionid){ $sec_activity_array[$cnt] = array('modid'=>$arr[$i]['modid'],'modname'=>$arr[$i]['modname'],'modcontent'=>$arr[$i]['modcontent']); $cnt++; } } return $sec_activity_array; } // Get all course sections in a array function get_sections($sections) { $cnt=0; $sec_array = array(); foreach ($sections as $sec) { $sec_array[$cnt++] = array('secid'=>$sec->id,'secname'=>$sec->name); } return $sec_array; } $activities=get_activities($secid,$arr); $html='';global $CFG; for($i=0;$i<count($activities);$i++) { $html .= '<tr > <td ><span class="mod' . $activities[$i]['modid'] . '">' . ($i + 1) . '</span></td> <td ><span class="mod' . $activities[$i]['modid'] . '">' . $activities[$i]['modname'] . '</span></td> <td ><span class="mod' . $activities[$i]['modid'] . '">' . $activities[$i]['modcontent'] . '</span></td> <td > <button class="showhide" id="show" value=' . $activities[$i]['modid'] . '> <img alt="start" src="'.$CFG->wwwroot.'/teacher/testcenter/images/start.png" width="16px"/></button> <button class="showhide" id="hide" value=' . $activities[$i]['modid'] . '> <img alt="stop" src="'.$CFG->wwwroot.'/teacher/testcenter/images/stop.png" width="16px"/></button> </td> </tr>'; } echo $html; }//end of section_activities() function
function get_dept_data() { $depts = get_depts(); foreach ($depts as &$dept) { $dept->eval_sections = get_sections($dept->id); foreach ($dept->eval_sections as &$section) { $section->questions = get_questions($section->id); } } return serialize($depts); }
} } return $sec_activity_array; } $course = get_course($id); //print_r($course); //initializing all variables using vpl object //$vpl = new mod_vpl($id); //$course = $vpl->get_course(); //$cm = $vpl->get_course_module(); //$context_module = $vpl->get_context(); //$currentgroup = groups_get_activity_group($cm, true); $modinfo = get_fast_modinfo($course); $mods = $modinfo->get_cms(); $sections = $modinfo->get_section_info_all(); $sec_array = get_sections($sections); $cm = $modinfo->get_cm($course->id); $currentgroup = groups_get_activity_group($cm, true); $context_module = context_course::instance($course->id); $cid = $course->id; //var_dump($sec_array); //preparing an array which contains sections and activities foreach ($mods as $mod) { $arr[$cnt++] = array('secid' => $mod->section, 'modid' => $mod->id, 'modname' => $mod->name, 'modcontent' => $mod->content); //print_r($mod->name); } $activities = get_activities($secid, $arr); //var_dump($currentgroup); if (!$currentgroup) { $currentgroup = ''; }
protected function sections() { global $db; $params = array(); if ($this->method == "GET") { if (sizeof($this->args) == 0) { return get_sections($db, $params); } else { return "This returns all sections, therefore no parameters are taken!"; } } else { return "This only accepts GET requests!"; } }
/** * Output all the sections HTML to output to the page * @param String $id This post or page's ID */ function the_sections($id = '') { $html = get_sections($id); echo $html; }
function create_sec_table($dept_id) { //generates html for section table //create html and return $result = "<h3>Sections</h3>\n\n\t\t<table class='seufolios' id='seufolios_sections_table'>\n\n\t\t<tr><th>Title</th><th>Description</th><th></th></tr>"; $sections = get_sections($dept_id); foreach ($sections as $section) { $result .= "<tr id='secrow_{$section->id}'>\n\t\t\t\t\t<td class='title'>{$section->title}</td>\n\t\t\t\t\t<td class='desc'>{$section->description}</td>\n\t\t\t\t\t<td class='butts'>\n\t\t\t\t\t <button id='edit_{$section->id}' class='edit_button' type='button' onclick='edit_section({$section->id}, {$section->order_loc});'>Edit</button> \n\t\t\t\t\t\t<button id='show_questions_{$section->id}' class='show_questions_button' type='button' onclick='show_questions({$section->id}, this)'>»</button>\n\t\t\t\t\t</td></tr>\n"; } $result .= "</table>"; return $result; }
if (!$id) { echo '<span style="font-weight: bold; color: red;">Tekkis viga muutujate informatsiooni leidmisel.</span>'; exit; } $sql_countries = 'INSERT INTO `newcms2_catalog_variable_selection` (`ID`,`parentID`,`name_eng`,`name_est`) VALUES '; $sql_sections = 'INSERT INTO `newcms2_catalog_category` (`ID`,`parentID`,`title_eng`,`title_est`,`name_eng`,`name_est`,`title_rus`,`name_rus`,`content_eng`,`content_est`) VALUES '; $sql_cinemas = 'INSERT INTO `newcms2_catalog_product_cinemas` (`id`,`title_eng`,`title_est`) VALUES '; $sql_films = 'INSERT INTO `newcms2_catalog_product` (`ID`,`parentID`,`title_est`,`title_eng`,`title_rus`,`name`,`title_visible`,`last_modified`,`modifier`) VALUES '; $sql_films_variables = 'INSERT INTO `newcms2_catalog_product_value` (`productID`,`variableID`,`value_est`,`value_eng`,`value_boolean`,`value_id`) VALUES '; $sql_films_categoris = 'INSERT INTO `newcms2_catalog_product_category` (`productID`,`categoryID`) VALUES '; $sql_directors = 'INSERT INTO `newcms2_catalog_product_directors` (`id`,`name`,`surname`,`filmography_eng`,`filmography_est`,`bio_eng`,`bio_est`,`statement_eng`,`statement_est`) VALUES '; $sql_screenings = 'INSERT INTO `newcms2_catalog_product_screenings` (`id`,`film_id`, `date`, `time`, `cinema_id`, `ID_AKCE`, `buylink`, `subtitles`, `info_est`, `info_eng`, `code`) VALUES '; // receiving non-removable variables and their values $old_values = get_variables_values(array($id['youtube'], $id['keywords'], $id['webpage'])); $old_screenings = get_screenings(); $old_sections = get_sections(); $films_ids = array(); $related_categories = array(); $related_countries = array(); $related_directors = array(); $related_cinemas = array(); $credits_estonian_replaceable = array('Prod:', 'Sts:', 'Op:', 'Muusika:', 'Mont:', 'Os:', 'Tootja:', 'Maailma müük:', 'Levitaja:', 'Filmikoopia:', '<BR>'); $credits_estonian_replacement = array('<b>Produtsent</b>:', '<b>Stsenarist</b>:', '<b>Operaator</b>:', '<b>Muusika</b>:', '<b>Montaaž</b>:', '<b>Osatäitjad</b>:', '<b>Tootja</b>:', '<b>Maailma müük</b>:', '<b>Levitaja</b>:', '<b>Filmikoopia</b>:', '<br />'); $credits_english_replaceable = array('Prod:', 'Scr:', 'DoP:', 'Music:', 'Ed:', 'Cast:', 'Production:', 'World Sales:', 'Distributor:', 'Print:', '<BR>'); $credits_english_replacement = array('<b>Producer</b>:', '<b>Scriptwriter</b>:', '<b>Director of Photography</b>:', '<b>Music</b>:', '<b>Editor</b>:', '<b>Cast</b>:', '<b>Production</b>:', '<b>World Sales</b>:', '<b>Distributor</b>:', '<b>Print</b>:', '<br />'); $unique_films = array(); foreach ($imports[3]['POFF_FILMS'] as $film) { if (!in_array($film['film_id'], $unique_films)) { // trimming and escaping all array values foreach ($film as &$param) { $param = mysql_real_escape_string(htmlspecialchars(trim($param)));
<?php include '/../queries/get_queries.php'; /* Operations */ if (isset($_GET['req'])) { switch ($_GET['req']) { case 0: get_nav_items($connection); break; case 1: get_sections($connection); break; default: print '[["ERROR"]["Request had an invalid ID"]]'; } } function get_sections($connection) { $connection->begin_transaction(); $get_section_query = <<<SQL select s.id, s.type, s.title from section s order by s.order asc; SQL; if ($results = $connection->query($get_section_query)) { $result_array = []; while ($row = $results->fetch_assoc()) { $id = $row['id']; $type = $row['type']; $array_builder = array("id" => $id, "title" => $row['title'], "type" => $type, "text" => "", "buttonText" => "", "images" => [], "youtubes" => []); if ($type == "TEXT" || $type == "INTRO" || $type == "JOIN" || $type == "MODS") {
function get_courselist($course) { global $CFG; $html = "<table class='generaltable search-table' id='cours' width='100%'> <thead> <tr> <th style='width: 10%;'>Select</th> <th style='width: 40%;'>Topics</th> <th style='width: 50%;'>Activities</th> </tr> </thead> <tbody id='cbody'>"; $ehtml=$html; $modinfo = get_fast_modinfo($course); $mods = $modinfo->get_cms(); $sections = $modinfo->get_section_info_all(); $arr = array(); $main_array = get_sections($sections); // Activity loop $arr = get_activities($mods, $main_array); //var_dump($arr); $ptop = ''; $com=0;$tot=0; $ht=''; $count=0; $che=0; foreach ($mods as $mod) { $top = $main_array[$mod->section]; if ($main_array[$mod->section] == "") continue; if ($ptop != $mod->section) { $activitycounter=0;$completioncounter=0; foreach ($arr[$mod->section] as $modsec) { $activitycounter++; $com+=(int)$modsec['completion']; $tot+=(int)$modsec['count']; $ht .= "<span >".$modsec['completion'] .' of ' . $modsec['count']."</span>"; $src=$CFG->wwwroot.'/pix/'.$modsec['modname'].'.jpeg'; $ht .=" <img src=$src alt=".$modsec['modname']." title=".$modsec['modname']." />"; $ht .= "     "; if($modsec['completion']==$modsec['count']) $completioncounter++; } if($completioncounter==$activitycounter){ $classvar='seccompleted'; $sta='disabled="true"'; //print_r("completed"); $sel=''; } else{ $classvar=''; $sta=''; if($che==0) { $sel='checked'; $che++; } else{ $sel=''; } //print_r("not completed"); } $html .= html_writer::start_tag('tr', array('class' => $course->id.' '.$classvar)); $html .= html_writer::start_tag('td'); $html .= "<input type='radio' name='topics' class='rdo' $sel $sta value ='$course->id-$mod->section'/>"; $html .= html_writer::end_tag('td'); $html .= html_writer::start_tag('td'); $html .= "<span >".$top."</span>"; $html .= html_writer::end_tag('td'); $html .= html_writer::start_tag('td'); $html .=$ht; $ht=''; $html .= html_writer::end_tag('td'); $html .= html_writer::end_tag('tr'); $count++; } $ptop = $mod->section; } $html.="</tbody></table>"; $html.="<p class='tabres'>($count) results found</p>"; $sta=$com.','.$tot; if($count==0){ $html=$ehtml."<tr><td colspan='3' style='text-align:center'><div class='nores'><h4> No Chapters found for this course</h4></div></td></tr><tr><td colspan='3' style='padding: 15px 0px !important; '></td></tr><tr><td colspan='3' style='padding: 15px 0px !important; ' ></td></tr><tr><td colspan='3' style='padding: 15px 0px !important; ' ></td></tr><tr><td colspan='3' style='padding: 15px 0px !important; '></td></tr></tbody></table>"; } $html.="<input type='hidden' id='cstatus' value='$sta'/>"; return $html; }