$values['group'] = isset($values['group']) ? $values['group'] : '0';
 $form->addElement('checkbox', 'send_mail', null, get_lang('SendMail'));
 if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') {
     $form->addElement('checkbox', 'add_to_calendar', null, get_lang('AddToCalendar'));
     $text = get_lang('AddNews');
     $class = 'add';
     $form->addElement('hidden', 'action', 'add');
 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
     $text = get_lang('EditNews');
     $class = 'save';
     $form->addElement('hidden', 'action', 'edit');
 }
 $form->addElement('checkbox', 'send_email_test', null, get_lang('SendOnlyAnEmailToMySelfToTest'));
 $form->addElement('style_submit_button', 'submit', $text, 'class="' . $class . '"');
 if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
     $values['content'] = WCAG_Rendering::HTML_to_text($values['content']);
 }
 $form->setDefaults($values);
 if ($form->validate()) {
     $values = $form->exportValues();
     if (!isset($values['visible_teacher'])) {
         $values['visible_teacher'] = false;
     }
     if (!isset($values['visible_student'])) {
         $values['visible_student'] = false;
     }
     if (!isset($values['visible_guest'])) {
         $values['visible_guest'] = false;
     }
     if ($values['lang'] == 'all') {
         $values['lang'] = null;
Exemplo n.º 2
0
 function extract_data($xhtml)
 {
     $text = $xhtml;
     if (stripos($xhtml, '<p>')) {
         $startP = stripos($xhtml, "<p>");
         $endP = stripos($xhtml, "</p>");
         $text = substr($xhtml, $startP + 3, $endP - $startP - 3);
     }
     // convert HTML to text.
     $text = WCAG_Rendering::HTML_to_text($text);
     $url = '';
     if (stripos($xhtml, '<img')) {
         $startImgURL = stripos($xhtml, "src=\"");
         $endImgURL = stripos($xhtml, "\" ");
         $url = substr($xhtml, $startImgURL + 5, $endImgURL - $startImgURL - 5);
         $subxhtml = substr($xhtml, $endImgURL + 2, $startP);
         $startImgLabel = stripos($subxhtml, "alt=\"");
         $endImgLabel = stripos($subxhtml, "\" ");
         $label = substr($subxhtml, $startImgLabel + 5, $endImgLabel - $startImgLabel - 5);
     }
     $subxhtml = substr($xhtml, $endImgURL + 2, $startP);
     $startImgLabel = stripos($subxhtml, "alt=\"");
     $endImgLabel = stripos($subxhtml, "\" ");
     $label = substr($subxhtml, $startImgLabel + 5, $endImgLabel - $startImgLabel - 5);
     $subxhtml = substr($xhtml, $endP + 2, 9999999999);
     $link = "";
     $linkLabel = "";
     if (stripos($subxhtml, '<a href')) {
         $startLinkURL = stripos($subxhtml, "ref=\"");
         $endLinkURL = stripos($subxhtml, "\">");
         $link = substr($subxhtml, $startLinkURL + 5, $endLinkURL - $startLinkURL - 5);
         $endLinkLabel = stripos($subxhtml, "</a>");
         $linkLabel = substr($subxhtml, $endLinkURL + 2, $endLinkLabel - $endLinkURL - 2);
     }
     $values = array("text" => $text, "imagefile" => $url, "imageLabel" => $label, "link" => $link, "linkLabel" => $linkLabel);
     return $values;
 }