ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç home/smkb8269/public_html/lms.smk-almanshuriyah.sch.id/lib/form/defaultcustom.php000064400000027525152267601350024004 0ustar00. /** * Creates an element with a dropdown Default/Custom and an input for the value (text or date_selector) * * @package core_form * @copyright 2017 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ global $CFG; require_once($CFG->libdir . '/form/group.php'); require_once($CFG->libdir . '/formslib.php'); /** * Creates an element with a dropdown Default/Custom and an input for the value (text or date_selector) * * @package core_form * @copyright 2017 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class MoodleQuickForm_defaultcustom extends MoodleQuickForm_group { /** * @var array These complement separators, they are appended to the resultant HTML. */ protected $_wrap = array('', ''); /** * @var null|bool Keeps track of whether the date selector was initialised using createElement * or addElement. If true, createElement was used signifying the element has been * added to a group - see MDL-39187. */ protected $_usedcreateelement = true; /** @var array */ protected $_options; /** * Constructor * * @param string $elementname Element's name * @param mixed $elementlabel Label(s) for an element * @param array $options Options to control the element's display * @param mixed $attributes Either a typical HTML attribute string or an associative array */ public function __construct($elementname = null, $elementlabel = null, $options = array(), $attributes = null) { parent::__construct($elementname, $elementlabel); $this->setAttributes($attributes); $this->_appendName = true; $this->_type = 'defaultcustom'; $calendartype = \core_calendar\type_factory::get_calendar_instance(); $this->_options = [ 'type' => 'text', // Type of the element. Supported are 'text' and 'date_selector'. 'defaultvalue' => null, // Value to be used when not overridden. 'customvalue' => null, // Value to be used when overwriting. 'customlabel' => get_string('custom', 'form'), // Label for 'customize' checkbox // Other options are the same as the ones that can be passed to 'date_selector' element. 'timezone' => 99, 'startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(), 'defaulttime' => 0, 'step' => 1, 'optional' => false, ]; if (is_array($options)) { foreach ($options as $name => $value) { if (array_key_exists($name, $this->_options)) { if ($name === 'type' && !in_array($value, ['text', 'date_selector', 'date_time_selector'])) { throw new coding_exception('Only text, date_selector, and date_time_selector elements are supported in ' . $this->_type); } if ($name === 'optional' && $value) { throw new coding_exception('Date selector can not be optional in ' . $this->_type); } $this->_options[$name] = $value; } } } } /** * Converts timestamp to the day/month/year array in the current calendar format * @param int $value * @return array */ protected function timestamp_to_date_array($value) { $calendartype = \core_calendar\type_factory::get_calendar_instance(); $currentdate = $calendartype->timestamp_to_date_array((int)$value, $this->_options['timezone']); return array( 'minute' => $currentdate['minutes'], 'hour' => $currentdate['hours'], 'day' => $currentdate['mday'], 'month' => $currentdate['mon'], 'year' => $currentdate['year']); } /** * Should this element have default/custom switch? * * @return bool */ protected function has_customize_switch() { return $this->_options['defaultvalue'] !== null; } /** * This will create all elements in the group */ public function _createElements() { if (!$this->has_customize_switch()) { $element = $this->createFormElement('hidden', 'customize', 1); } else { $element = $this->createFormElement('advcheckbox', 'customize', '', $this->_options['customlabel']); } $this->_elements[] = $element; if ($this->_options['type'] === 'text') { $element = $this->createFormElement($this->_options['type'], 'value', get_string('newvaluefor', 'form', $this->getLabel()), $this->getAttributes()); $element->setHiddenLabel(true); } else if ($this->_options['type'] === 'date_selector') { $element = $this->createFormElement($this->_options['type'], 'value', '', $this->_options, $this->getAttributes()); } else if ($this->_options['type'] === 'date_time_selector') { $element = $this->createFormElement($this->_options['type'], 'value', '', $this->_options, $this->getAttributes()); } $this->_elements[] = $element; } /** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @return bool */ public function onQuickFormEvent($event, $arg, &$caller) { $this->setMoodleForm($caller); switch ($event) { case 'updateValue': // Constant values override both default and submitted ones // default values are overriden by submitted. $value = $this->_findValue($caller->_constantValues); if (null === $value) { // If no boxes were checked, then there is no value in the array // yet we don't want to display default value in this case. if ($caller->isSubmitted()) { $value = $this->_findValue($caller->_submitValues); } else { $value = $this->_findValue($caller->_defaultValues); } } if (!is_array($value)) { $customize = ($value !== false || !$this->has_customize_switch()); if ($this->_options['type'] === 'text') { $elementvalue = $customize ? $value : $this->_options['defaultvalue']; } else { $elementvalue = $this->timestamp_to_date_array($customize ? $value : $this->_options['defaultvalue']); } $value = [ 'customize' => $customize, 'value' => $elementvalue ]; } $this->setValue($value); break; case 'createElement': $rv = parent::onQuickFormEvent($event, $arg, $caller); if ($this->has_customize_switch()) { if ($this->_options['type'] === 'text') { $caller->disabledIf($arg[0] . '[value]', $arg[0] . '[customize]', 'notchecked'); } else if ($this->_options['type'] === 'date_selector') { $caller->disabledIf($arg[0] . '[value][day]', $arg[0] . '[customize]', 'notchecked'); $caller->disabledIf($arg[0] . '[value][month]', $arg[0] . '[customize]', 'notchecked'); $caller->disabledIf($arg[0] . '[value][year]', $arg[0] . '[customize]', 'notchecked'); } else { // Date / Time selector. $caller->disabledIf($arg[0] . '[value][day]', $arg[0] . '[customize]', 'notchecked'); $caller->disabledIf($arg[0] . '[value][month]', $arg[0] . '[customize]', 'notchecked'); $caller->disabledIf($arg[0] . '[value][year]', $arg[0] . '[customize]', 'notchecked'); $caller->disabledIf($arg[0] . '[value][hour]', $arg[0] . '[customize]', 'notchecked'); $caller->disabledIf($arg[0] . '[value][minute]', $arg[0] . '[customize]', 'notchecked'); } } return $rv; case 'addElement': $this->_usedcreateelement = false; return parent::onQuickFormEvent($event, $arg, $caller); break; default: return parent::onQuickFormEvent($event, $arg, $caller); } } public function freeze() { parent::freeze(); $this->setPersistantFreeze(true); } public function toHtml() { include_once('HTML/QuickForm/Renderer/Default.php'); $renderer = new HTML_QuickForm_Renderer_Default(); $renderer->setElementTemplate('{element}'); parent::accept($renderer); $html = $this->_wrap[0]; if ($this->_usedcreateelement) { $html .= html_writer::tag('span', $renderer->toHtml(), array('class' => 'fdefaultcustom')); } else { $html .= $renderer->toHtml(); } $html .= $this->_wrap[1]; return $html; } public function accept(&$renderer, $required = false, $error = null) { global $PAGE; if (!$this->_flagFrozen && $this->has_customize_switch()) { // Add JS to the default/custom switch. $firstelement = reset($this->_elements); $defaultvalue = $this->_options['defaultvalue']; $customvalue = $this->_options['customvalue']; if ($this->_options['type'] === 'date_selector' || $this->_options['type'] === 'date_time_selector') { $defaultvalue = $this->timestamp_to_date_array($defaultvalue); $customvalue = $this->timestamp_to_date_array($customvalue); } $firstelement->updateAttributes(['data-defaultcustom' => 'true', 'data-type' => $this->_options['type'], 'data-defaultvalue' => json_encode($defaultvalue), 'data-customvalue' => json_encode($customvalue)]); $PAGE->requires->js_amd_inline("require(['core_form/defaultcustom'], function() {});"); } $renderer->renderElement($this, $required, $error); } /** * Output a value. Give it the name of the group. In case of "default" return false. * * @param array $submitvalues values submitted. * @param bool $assoc specifies if returned array is associative * @return array */ public function exportValue(&$submitvalues, $assoc = false) { $valuearray = array(); foreach ($this->_elements as $element) { $thisexport = $element->exportValue($submitvalues[$this->getName()], true); if ($thisexport != null) { $valuearray += $thisexport; } } if (empty($valuearray['customize'])) { return $this->_prepareValue(false, $assoc); } return array_key_exists('value', $valuearray) ? $this->_prepareValue($valuearray['value'], $assoc) : []; } }