|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00026 // get blocks? 00027 $toblock = optional_param('mymobile_blocks', false, PARAM_BOOL); 00028 // get settings? 00029 $toset = optional_param('mymobile_settings', false, PARAM_BOOL); 00030 00031 $mypagetype = $PAGE->pagetype; 00032 $mylayoutype = $PAGE->pagelayout; 00033 $mydevice = $PAGE->devicetypeinuse; 00034 00035 if (!empty($PAGE->theme->settings->colourswatch)) { 00036 $showswatch = $PAGE->theme->settings->colourswatch; 00037 } else { 00038 $showswatch = 'light'; 00039 } 00040 00041 if ($showswatch == 'light') { 00042 $dtheme = 'd'; 00043 $dthemeb = 'd'; 00044 $datatheme = 'data-theme="b"'; 00045 $databodytheme = 'data-theme="d"'; 00046 } else { 00047 $dtheme = 'd'; 00048 $dthemeb = 'c'; 00049 $datatheme = 'data-theme="a"'; 00050 $databodytheme = ''; 00051 } 00052 00053 //custom settings 00054 $hasshowmobileintro = (!empty($PAGE->theme->settings->showmobileintro)); 00055 00056 if (!empty($PAGE->theme->settings->showfullsizeimages)) { 00057 $hasithumb = $PAGE->theme->settings->showfullsizeimages; 00058 } else { 00059 $hasithumb = 'ithumb'; 00060 } 00061 00062 if (!empty($PAGE->theme->settings->showsitetopic)) { 00063 $showsitetopic = $PAGE->theme->settings->showsitetopic; 00064 } else { 00065 $showsitetopic = 'topicnoshow'; 00066 } 00067 00068 if (!empty($PAGE->theme->settings->usetableview)) { 00069 $showusetableview = $PAGE->theme->settings->usetableview; 00070 } else { 00071 $showusetableview = 'tabshow'; 00072 } 00073 00074 // TODO: Fix this hardcoding there are other course formats that peopleuse. 00075 // Probably changing to an appropriate regex will do. 00076 if ($mypagetype == 'course-view-topics' || $mypagetype == 'course-view-weeks') { 00077 // jump to current topic only in course pages 00078 $jumptocurrent = 'true'; 00079 } else { 00080 $jumptocurrent = 'false'; 00081 } 00082 00083 // below sets a URL variable to use in some links 00084 $urlblocks = new moodle_url($PAGE->url, array('mymobile_blocks' => 'true')); 00085 $urlsettings = new moodle_url($PAGE->url, array('mymobile_settings' => 'true')); 00086 00087 $hasheading = ($PAGE->heading); 00088 $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar()); 00089 $hasfooter = (empty($PAGE->layout_options['nofooter'])); 00090 $hasmyblocks = $PAGE->blocks->region_has_content('myblocks', $OUTPUT); 00091 00092 $bodyclasses = array(); 00093 $bodyclasses[] = (string)$hasithumb; 00094 $bodyclasses[] = (string)$showsitetopic; 00095 // add ithumb class to decide whether to show or hide images and site topic 00096 00097 // TODO: Better illustrate preceedence 00098 $gowide = ($mydevice == 'default' && $showusetableview == 'tabshow' || $mydevice == 'tablet' && $showusetableview == 'tabshow'); 00099 if ($gowide) { 00100 // initialize column position choices. 00101 mymobile_initialise_colpos($PAGE); 00102 } 00103 $usercol = (mymobile_get_colpos() == 'on'); 00104 00105 $renderer = $PAGE->get_renderer('theme_mymobile'); 00106 00107 echo $OUTPUT->doctype() ?> 00108 <html <?php echo $OUTPUT->htmlattributes() ?>> 00109 <head> 00110 <title><?php echo $PAGE->title ?></title> 00111 <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" /> 00112 <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo $OUTPUT->pix_url('m2m2x', 'theme')?>" /> 00113 <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo $OUTPUT->pix_url('m2m', 'theme')?>" /> 00114 <link rel="apple-touch-icon-precomposed" href="<?php echo $OUTPUT->pix_url('m2m', 'theme')?>" /> 00115 00116 <meta name="description" content="<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>" /> 00117 <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" /> 00118 00119 <?php echo $OUTPUT->standard_head_html() ?> 00120 </head> 00121 <body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>"> 00122 <?php echo $OUTPUT->standard_top_of_body_html() ?> 00123 <div id="<?php p($PAGE->bodyid) ?>PAGE" data-role="page" class="generalpage <?php echo 'ajaxedclass '; p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)); ?> <?php if ($hasmyblocks && $usercol) { echo 'has-myblocks'; } ?> " data-title="<?php p($SITE->shortname) ?>"> 00124 <!-- start header --> 00125 <div data-role="header" <?php echo($datatheme);?> class="mymobileheader"> 00126 <h1><?php echo $PAGE->heading ?></h1> 00127 <?php if (isloggedin() && $mypagetype != 'site-index') { ?> 00128 <a class="ui-btn-right" data-icon="home" href="<?php p($CFG->wwwroot) ?>" data-iconpos="notext" data-ajax="false"><?php p(get_string('home')); ?></a> 00129 <?php } else if (!isloggedin()) { 00130 echo $OUTPUT->login_info(); 00131 } ?> 00132 <!-- start navbar --> 00133 <div data-role="navbar"> 00134 <ul> 00135 <?php if (!$gowide && !$hasmyblocks && !$toblock && $mypagetype == "mod-quiz-attempt" || !$gowide && !$hasmyblocks && !$toblock && $mylayoutype != "incourse") { ?> 00136 <li><a data-theme="c" class="blockload" href="<?php echo $urlblocks->out(); ?>"><?php p(get_string('blocks')); ?></a></li> 00137 <?php } ?> 00138 <?php if (!$toset) { ?> 00139 <li><a data-theme="c" href="<?php echo $urlsettings->out(); ?>"><?php p(get_string('settings')); ?></a></li> 00140 <?php } ?> 00141 <?php if ($jumptocurrent == 'true' && !$toblock && !$toset) { ?> 00142 <li><a data-theme="c" class="jumptocurrent" href="#"><?php p(get_string('jump')); ?></a></li> 00143 <?php } ?> 00144 <?php if (isloggedin() && $hasnavbar) { ?> 00145 <li><?php echo $OUTPUT->navbar(); ?></li> 00146 <?php } ?> 00147 </ul> 00148 </div> 00149 <!-- end navbar --> 00150 </div> 00151 <div id="page-header"><!-- empty page-header needed by moodle yui --></div> 00152 <!-- end header --> 00153 00154 <!-- main content --> 00155 <div data-role="content" class="mymobilecontent" <?php echo $databodytheme; ?>> 00156 <?php if($toset) { //if we get the true, that means load/show settings only ?> 00157 <h2 class="jsets"><?php p(get_string('settings')); ?></h2> 00158 <?php 00159 //load lang menu if available 00160 echo $OUTPUT->lang_menu(); 00161 ?> 00162 <ul data-role="listview" data-theme="<?php echo $dthemeb;?>" data-dividertheme="<?php echo $dtheme;?>" data-inset="true" class="settingsul"> 00163 <?php echo $renderer->settings_tree($PAGE->settingsnav); ?> 00164 </ul> 00165 <?php echo $OUTPUT->login_info(); ?> 00166 <?php } ?> 00167 00168 <div class="content-primary"> 00169 <div class="region-content <?php if ($toblock) { echo 'mobile_blocksonly'; } ?>" id="themains"> 00170 <?php 00171 //only show main content if we are not showing anything else 00172 if (!$toblock && !$toset) { ?> 00173 <?php if ($hasshowmobileintro && $mypagetype == 'site-index') { ?> 00174 <?php echo $PAGE->theme->settings->showmobileintro; ?> 00175 <?php } ?> 00176 <?php echo $OUTPUT->main_content(); ?> 00177 <?php } ?> 00178 </div> 00179 </div> 00180 00181 <?php if ($gowide && $hasmyblocks && !$toset) { 00182 //if we get the true, that means load/show blocks only for tablet views only ?> 00183 <div class="content-secondary"> 00184 <div class="tablets"> 00185 <h1><?php echo $PAGE->heading ?></h1> 00186 <span><?php echo $PAGE->course->summary; ?></span> 00187 </div> 00188 00189 <?php if ($hasmyblocks) { ?> 00190 <div data-role="collapsible-set" data-theme="<?php echo $dthemeb;?>"> 00191 <?php echo $OUTPUT->blocks_for_region('myblocks') ?> 00192 </div> 00193 <?php } ?> 00194 00195 <?php if ($gowide && isloggedin() && !isguestuser()) { ?> 00196 00197 <div data-role="collapsible" data-collapsed="false" <?php echo $datatheme;?> data-content-theme="<?php echo $dthemeb;?>" id="profcol"> 00198 <h3><?php p(''.$USER->firstname.' '.$USER->lastname.''); ?></h3> 00199 <div class="ui-grid-a"> 00200 <div class="ui-block-a"> 00201 <?php echo html_writer::tag('div', $OUTPUT->user_picture($USER, array('size'=>80)), array('class'=>'userimg'));?> 00202 </div> 00203 <div class="ui-block-b"> 00204 <a data-role="button" data-icon="home" href="<?php p($CFG->wwwroot) ?>/my/"><?php p(get_string('myhome')); ?></a> 00205 <a data-role="button" data-icon="info" href="<?php p($CFG->wwwroot) ?>/user/profile.php"><?php p(get_string('myprofile')); ?></a> 00206 <a data-role="button" data-icon="back" data-ajax="false" href="<?php p($CFG->wwwroot) ?>/login/logout.php"><?php p(get_string('logout')); ?></a> 00207 </div> 00208 </div> 00209 </div> 00210 00211 <div data-role="fieldcontain" id="sliderdiv"> 00212 <label for="slider"><?php p(get_string('mtoggle','theme_mymobile')); ?>:</label> 00213 <select name="slider" class="slider" data-role="slider" data-track-theme="b"> 00214 <option value="on">On</option> 00215 <option value="off">Off</option> 00216 </select> 00217 </div> 00218 00219 <?php } else if (!isloggedin() || isguestuser()) { ?> 00220 <a data-role="button" <?php echo $datatheme;?> data-ajax="false" href="<?php p($CFG->wwwroot) ?>/login/index.php"><?php p(get_string('login')); ?></a> 00221 <?php } ?> 00222 </div> 00223 <?php } ?> 00224 00225 <?php 00226 if ($toblock && !$gowide) { 00227 //regular block load for phones + handhelds 00228 if ($hasmyblocks) { 00229 ?><div class="headingwrap ui-bar-<?php echo $dtheme;?> ui-footer jsetsbar"> 00230 <h2 class="jsets ui-title"><?php p(get_string('blocks')); ?></h2> 00231 </div> 00232 <div data-role="collapsible-set"><?php echo $OUTPUT->blocks_for_region('myblocks') ?></div><?php 00233 } 00234 } 00235 ?> 00236 </div> 00237 <!-- end main content --> 00238 00239 <!-- start footer --> 00240 <div data-role="footer" class="mobilefooter" <?php echo $datatheme;?>> 00241 <div data-role="navbar" class="jnav" > 00242 <ul> 00243 <li><a id="mycal" class="callink" href="<?php p($CFG->wwwroot) ?>/calendar/view.php" data-icon="info" data-iconpos="top" ><?php p(get_string('calendar', 'calendar')); ?></a></li> 00244 <?php if (!empty($CFG->messaging)) { ?> 00245 <li><a id="mymess" href="<?php p($CFG->wwwroot) ?>/message/index.php" data-iconpos="top" data-icon="mymessage" ><?php p(get_string('messages', 'message')); ?></a></li> 00246 <?php } ?> 00247 <?php if ($mypagetype != 'site-index') { ?> 00248 <li><a href="#" data-inline="true" data-role="button" data-iconpos="top" data-icon="arrow-u" id="uptotop"><?php p(get_string('up')); ?></a></li> 00249 <?php } ?> 00250 </ul> 00251 </div> 00252 </div> 00253 <!-- end footer --> 00254 00255 <div id="underfooter"> 00256 <?php 00257 echo $OUTPUT->login_info_footer(); 00258 echo '<div class="noajax">'; 00259 echo $OUTPUT->standard_footer_html(); 00260 echo '</div>'; 00261 ?> 00262 </div> 00263 </div><!-- ends page --> 00264 00265 <!-- empty divs with info for the JS to use --> 00266 <div id="<?php echo sesskey(); ?>" class="mobilesession"></div> 00267 <div id="<?php p($CFG->wwwroot); ?>" class="mobilesiteurl"></div> 00268 <div id="<?php echo $dtheme;?>" class="datatheme"></div> 00269 <div id="<?php echo $dthemeb;?>" class="datathemeb"></div> 00270 <div id="page-footer"><!-- empty page footer needed by moodle yui for embeds --></div> 00271 <!-- end js divs --> 00272 00273 <?php echo $OUTPUT->standard_end_of_body_html() ?> 00274 </body> 00275 </html>