Exemplo n.º 1
0
 public function render()
 {
     foreach ($this->checkboxes as $checkbox) {
         $is_checked = false;
         //-----------------------------------------
         // Is Checked?
         //-----------------------------------------
         if (isset($this->checked_value[$checkbox[0]]) && $this->checked_value[$checkbox[0]] == 1) {
             $is_checked = true;
         }
         //-----------------------------------------
         // Create Checkbox
         //-----------------------------------------
         $c = new checkbox($checkbox[0], $checkbox[1], $is_checked);
         //-----------------------------------------
         // Element Attributes
         //-----------------------------------------
         if (isset($this->elements_attrs[$checkbox[1]])) {
             $c->attrs($this->elements_attrs[$checkbox[1]]);
         }
         //-----------------------------------------
         // Output
         //-----------------------------------------
         print $c;
         if (isset($checkbox[2])) {
             print ' ' . $checkbox[2];
         }
         if ($this->style == 'newline') {
             print '<br/>';
         } else {
             if ($this->style == 'custom') {
                 print $this->custom_style;
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
 		@brief		Create a new checkbox option.
 		@param		object			$o		Options.
 		@return		checkbox		Newly-created checkbox.
 		@see		\\plainview\\sdk_broadcast\\form2\\inputs\\traits\\options::option()
 		@since		20130524
 	**/
 public function new_option($o)
 {
     $input = new checkbox($o->container, $o->name);
     if (isset($o->id)) {
         $input->set_attribute('id', $o->id);
     }
     if (isset($o->label)) {
         $input->label($o->label);
     }
     if (isset($o->name)) {
         $input->set_attribute('name', $this->get_name() . '_' . $o->name);
     } else {
         $input->set_attribute('name', $o->value);
     }
     $input->set_value($o->name);
     $input->label->update_for();
     return $input;
 }
Exemplo n.º 3
0
 public function display()
 {
     $template = new Template();
     $template->load("formeditor");
     $form = new Form($_GET['form']);
     if (isset($_POST['datatype']) && !isset($_POST['save'])) {
         $form->dataTypeID = $_POST['datatype'];
         $form->clearFieldsFromDB();
     }
     foreach ($_POST as $key => $value) {
         $id = explode('_', $key);
         $id = $id[0];
         if (is_numeric($id)) {
             $key = substr($key, strlen($id) + 1);
             $fields[$id][$key] = $value;
         }
     }
     if (isset($fields)) {
         foreach ($fields as $field) {
             $formField = new FormField();
             $formField->sortIndex = $field['sortIndex'];
             $formField->dataName = $field['dataname'];
             $formField->label = $field['label'];
             if ($field['insert']) {
                 $formField->insert = true;
             } else {
                 $formField->insert = false;
             }
             if (isset($field['mandatory']) && $field['mandatory']) {
                 $formField->mandatory = true;
             } else {
                 $formField->mandatory = false;
             }
             if ($field['show']) {
                 $formField->show = true;
             } else {
                 $formField->show = false;
             }
             $formField->edit = $field['edit'];
             $formField->preAllocate = $field['value'];
             $form->addField($formField);
         }
     }
     if (isset($_POST['save'])) {
         $form->buttonText = $_POST['buttontext'];
         $form->succeedMessage = $_POST['succeedmessage'];
         $form->dataTypeID = $_POST['datatype'];
         if (isset($_POST['captcha']) && $_POST['captcha']) {
             $form->captcha = true;
         } else {
             $form->captcha = false;
         }
         if (isset($_POST['showAfterInsert']) && $_POST['showAfterInsert']) {
             $form->showAfterInsert = true;
         } else {
             $form->showAfterInsert = false;
         }
         $form->save();
     }
     $combobox = new combobox();
     $combobox->fillSelect = "SELECT 0 as value, '' as label UNION SELECT id as value, displayName as label FROM {'dbprefix'}datatypes ORDER BY label";
     $combobox->value = $form->dataTypeID;
     $combobox->name = 'datatype';
     $combobox->onChange = "document.form.submit();";
     $template->assign_var("DATATYPE", $combobox->getCode());
     $buttonText = new textbox();
     $buttonText->name = "buttontext";
     $buttonText->value = $form->buttonText;
     $template->assign_var("BUTTONTEXT", $buttonText->getCode());
     $succeedMessage = new textbox();
     $succeedMessage->name = "succeedmessage";
     $succeedMessage->value = $form->succeedMessage;
     $template->assign_var("SUCCEEDMESSAGE", $succeedMessage->getCode());
     $captcha = new checkbox();
     $captcha->name = "captcha";
     $captcha->value = $form->captcha;
     $template->assign_var("CAPTCHA", $captcha->getCode());
     $showAfterInsert = new checkbox();
     $showAfterInsert->name = "showAfterInsert";
     $showAfterInsert->value = $form->showAfterInsert;
     $template->assign_var("SHOWAFTERINSERT", $showAfterInsert->getCode());
     $list = new CustomList();
     if ($form->isEmpty()) {
         $list->fillSelect = "SELECT *, @rownum:=@rownum+1 AS sortindex, 'checked' as show_check, '' as mandatory_check, 'checked' as insert_check, '\\'\\'' as preallocate FROM (SELECT @rownum:=0) r, {'dbprefix'}datafields WHERE dataType = '" . $form->dataTypeID . "' ORDER BY displayName";
     } else {
         $list->fillSelect = "SELECT *, label as displayname, @rownum:=@rownum+1 as id, IF( `show` = '1', 'checked', '' ) as show_check, IF( `insert` = '1', 'checked', '' ) as insert_check, IF( `mandatory` = '1', 'checked', '' ) as mandatory_check FROM (SELECT @rownum:=0) r, {'dbprefix'}form_fields WHERE form = '" . $form->id . "' ORDER by sortIndex";
     }
     $list->template = "formfield_editor";
     $list->paddingLeft = 0;
     $list->showButtons = false;
     $template->assign_var("FIELDS", $list->getCode());
     $template->output();
 }
Exemplo n.º 4
0
 /**
  * Method to add a grid cell.
  *
  * @param  object  The object action or rule used as the lookup.
  * @param  string  The id of the rule or condition to be found.
  * @param  string  The class for the row.
  *                     
  * @access public 
  * @author Jonathan Abrahams
  * @return nothing Inserts new cell into the table.
  */
 function addGridCell($objLookup, $id, $class)
 {
     extract($this->_properties);
     $X = $this->showX($objLookup, $id);
     $condRule = $this->class == 'condition_rule' && $objLookup->_name == $this->name;
     $actRule = $this->class == 'action_rule' && $id == $this->name;
     $cond = $this->class == 'condition' && $id == $this->name;
     $act = $this->class == 'action' && $objLookup->_name == $this->name;
     if ($cond || $act || $actRule || $condRule) {
         $checkbox = new checkbox("List[" . get_class($objLookup) . "][{$objLookup->_name}][{$id}]");
         $checkbox->setChecked($X);
         $X = $checkbox->show();
     } else {
         $X = $X ? "X" : "-";
     }
     $this->objGrid->addCell($X, $colWidth, NULL, 'center', $class);
 }
Exemplo n.º 5
0
         }
     } else {
         $fileDetails = $this->objFiles->getFile($file);
         if ($fileDetails != FALSE) {
             $counter++;
             $checkbox = new checkbox('files[]', htmlentities($fileDetails['filename']), TRUE);
             $checkbox->value = $file;
             $checkbox->cssId = $file;
             $form->addToForm('<li>' . $checkbox->show() . ' ' . htmlentities($fileDetails['filename']) . '</li>');
         } else {
             if (substr($file, 0, 9) == 'symlink__') {
                 $symlinkId = substr($file, 9);
                 $symlink = $this->objSymlinks->getFullSymlink($symlinkId);
                 if ($symlink != FALSE) {
                     $counter++;
                     $checkbox = new checkbox('files[]', htmlentities($symlink['filename']), TRUE);
                     $checkbox->cssId = $file;
                     $checkbox->value = $file;
                     $form->addToForm('<li>' . $checkbox->show() . ' ' . htmlentities($symlink['filename']) . '</li>');
                 }
             }
         }
     }
 }
 $form->addToForm('</ul>');
 $button = new button('submitform', $this->objLanguage->languageText('mod_filemanager_confirmdeleteselecteditems', 'filemanager', 'Confirm Delete Selected Items'));
 $button->setToSubmit();
 $form->addToForm($button->show());
 $folderInput = new hiddeninput('folder', $this->getParam('folder'));
 $this->setVar('folderId', $this->getParam('folder'));
 $form->addToForm($folderInput->show());
Exemplo n.º 6
0
 $table->addHeaderCell('&nbsp;', 20);
 $table->addHeaderCell($this->objLanguage->languageText('word_filename', 'filemanager', 'Filename'));
 $table->addHeaderCell($this->objLanguage->languageText('word_size', 'filemanager', 'Size'), '60', NULL, 'center', NULL);
 //$table->addHeaderCell('Description');
 //$table->addHeaderCell($this->objLanguage->languageText('phrase_dateuploaded', 'filemanager', 'Date Uploaded'), NULL, NULL, NULL, 'nowrap');
 $table->addHeaderCell('&nbsp;', 30);
 $table->endHeaderRow();
 $filesize = new formatfilesize();
 $objIcon->setIcon('download');
 $downloadIcon = $objIcon->show();
 $userfilespath = $this->objConfig->getcontentPath();
 foreach ($files as $file) {
     $link = new link($this->uri(array('action' => 'fileinfo', 'id' => $file['id'], 'type' => $file['category'], 'filename' => $file['filename'])));
     $link->link = htmlentities(str_replace('_', ' ', $file['filename']));
     $table->startRow();
     $checkbox = new checkbox('files[]');
     $checkbox->value = $file['id'];
     $checkbox->cssId = htmlentities('input_files_' . $file['filename']);
     $table->addCell($checkbox->show(), 20);
     $label = new label($objFileIcons->getFileIcon($file['filename']), htmlentities('input_files_' . $file['filename']));
     $table->addCell($label->show(), 20);
     $table->addCell($link->show());
     $table->addCell($filesize->formatsize($file['filesize']), '60', NULL, 'right', 'nowrap');
     //$table->addCell($file['description']);
     //$table->addCell($this->objFormatDateTime->formatDateOnly($file['datecreated']).' - '.$this->objFormatDateTime->formatTime($file['timecreated']), NULL, NULL, 'right', 'nowrap');
     $fileDownloadPath = $userfilespath . $file['path'];
     $fileDownloadPath = $this->objCleanUrl->cleanUpUrl($fileDownloadPath);
     $link = new link($fileDownloadPath);
     $link->link = $downloadIcon;
     $table->addCell($link->show(), '30');
     $table->endRow();
Exemplo n.º 7
0
 $newLOTable->border = '0';
 $table->startRow();
 $table->addCell(Null);
 $table->endRow();
 if ($outcomesCount > 0) {
     while ($newcount <= $outcomesCount) {
         //Create TextArea to hold the Learning outcome
         $editor = $this->newObject('htmlarea', 'htmlelements');
         $editor->name = 'learneroutcome_' . $count;
         $editor->height = '100px';
         $editor->width = '750px';
         $editor->setContent(Null);
         $editor->setMCQToolBar();
         //$loTxtArea = new textarea($name = 'learneroutcome_' . $count, Null, $rows = 2, $cols = 100);
         //Checkbox to select LO to delete
         $deleteLO = new checkbox($name = 'delete_learneroutcome_' . $count, $label = NULL, $ischecked = false);
         //Add Items to table
         $newLOTable->startRow();
         $newLOTable->addCell($count . ". ");
         $newLOTable->addCell($editor->show(), $width = '60%', $valign = "top", $align = "left");
         $newLOTable->addCell($deleteLO->show(), $width = '40%', $valign = "top", $align = "left");
         $newLOTable->endRow();
         $checkcount = $count;
         //Increment the count
         $newcount++;
         $count++;
     }
     //Hidden textinput to store the no of outcomes for editing
     $loAddCount = $this->newObject('textinput', 'htmlelements');
     $newcount = $newcount - 1;
     $loAddCount->textinput($name = 'loAddCount', $value = $outcomesCount, $type = 'hidden', $size = "4");
Exemplo n.º 8
0
 /**
  * Method to generate an edit context settings form
  * @param array $context Current Context Settings
  * @return str
  */
 public function editContextForm($context)
 {
     $header = new htmlheading();
     $header->type = 1;
     $header->str = $this->objLanguage->languageText('word_edit', 'system', 'Edit') . ': ' . $context['title'];
     $str = $header->show();
     $title = new textinput('title');
     $title->size = 50;
     if ($context != NULL) {
         $title->value = htmlentities($context['title']);
     }
     $titleLabel = new label($this->objLanguage->languageText('word_title', 'system', 'Title'), 'input_title');
     $status = new dropdown('status');
     //$status->setBreakSpace('<br />');
     $status->addOption('Published', $this->objLanguage->languageText('word_published', 'system', 'Published'));
     $status->addOption('Unpublished', $this->objLanguage->languageText('word_unpublished', 'system', 'Unpublished'));
     if ($context != NULL) {
         $status->setSelected($context['status']);
     }
     if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') {
         if (is_null($context)) {
             $access_ = 'Private';
         } else {
             $access_ = $context['access'];
         }
         $access = new hiddeninput('access', $access_);
     } else {
         $access = new radio('access');
         $access->setBreakSpace('<br />');
         $access->addOption('Public', '<strong>' . $this->objLanguage->languageText('word_public', 'system', 'Public') . '</strong> - <span class="caption">' . ucfirst($this->objLanguage->code2Txt('mod_context_publiccontextdescription', 'context', NULL, '[-context-] can be accessed by all users, including anonymous users')) . '</span>');
         $access->addOption('Open', '<strong>' . $this->objLanguage->languageText('word_open', 'system', 'Open') . '</strong> - <span class="caption">' . ucfirst($this->objLanguage->code2Txt('mod_context_opencontextdescription', 'context', NULL, '[-context-] can be accessed by all users that are logged in')) . '</span>');
         $access->addOption('Private', '<strong>' . $this->objLanguage->languageText('word_private', 'system', 'Private') . '</strong> - <span class="caption">' . $this->objLanguage->code2Txt('mod_context_privatecontextdescription', 'context', NULL, 'Only [-context-] members can enter the [-context-]') . '<span class="caption">');
         if ($context != NULL) {
             $access->setSelected($context['access']);
         } else {
             $access->setSelected('Public');
         }
     }
     $table = $this->newObject('htmltable', 'htmlelements');
     if ($context != NULL) {
         $table->startRow();
         $table->addCell(ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code')) . ':', 100);
         $table->addCell('<strong>' . $context['contextcode'] . '</strong>');
         $table->endRow();
     } else {
         $code = new textinput('contextcode');
         $codeLabel = new label(ucwords($this->objLanguage->code2Txt('mod_context_contextcode', 'context', NULL, '[-context-] Code')), 'input_contextcode');
         $table->startRow();
         $table->addCell($codeLabel->show(), 100);
         $table->addCell($code->show() . ' <span id="contextcodemessage"></span>');
         $table->endRow();
     }
     $table->startRow();
     $table->addCell($titleLabel->show() . ':');
     $table->addCell($title->show());
     $table->endRow();
     $table->startRow();
     $table->addCell('&nbsp;');
     $table->addCell('&nbsp;');
     $table->endRow();
     $table->startRow();
     $table->addCell($this->objLanguage->languageText('word_status', 'system', 'Status') . ':');
     $table->addCell($status->show());
     $table->endRow();
     if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'false') {
         $table->startRow();
         $table->addCell($this->objLanguage->languageText('word_access', 'system', 'Access') . ':');
         $table->addCell($access->show());
         $table->endRow();
     }
     $alerts = explode("|", $context['alerts']);
     $emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Email alerts'), $alerts[0] == 'e' || $alerts[0] == '1');
     // this will checked
     //$alerts=array();
     //$emailchecked=;
     //$emailAlert->setChecked(FALSE);
     //if($emailchecked) {
     //    $emailAlert->setChecked($emailchecked);
     //}
     $table->startRow();
     $table->addCell($this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Alerts'));
     $table->addCell($emailAlert->show());
     $table->endRow();
     $objSelectImage = $this->getObject('selectimage', 'filemanager');
     $objSelectImage->context = TRUE;
     $table2 = $this->newObject('htmltable', 'htmlelements');
     $table2->startRow();
     $table2->addCell($table->show(), 600, NULL, NULL, NULL, 'colspan="2"');
     $table2->addCell($objSelectImage->show());
     $table2->endRow();
     $table2->startRow();
     $table2->addCell('&nbsp;');
     $table2->addCell('&nbsp;');
     $table2->addCell('&nbsp;');
     $table2->endRow();
     $table2->startRow();
     $table2->addCell(ucwords($this->objLanguage->code2Txt('mod_context_aboutcontext', 'context', NULL, 'About [-context-]')) . ':', 100);
     $htmlEditor = $this->newObject('htmlarea', 'htmlelements');
     $htmlEditor->name = 'about';
     $htmlEditor->toolbarSet = 'advanced';
     if ($context != NULL) {
         $htmlEditor->value = $context['about'];
     }
     $table2->addCell($htmlEditor->show(), NULL, NULL, NULL, NULL, 'colspan="2"');
     $table2->endRow();
     $table2->startRow();
     $table2->addCell('&nbsp;');
     $table2->addCell('&nbsp;');
     $table2->addCell('&nbsp;');
     $table2->endRow();
     $table2->startRow();
     $table2->addCell('&nbsp;', 100);
     if ($context == NULL) {
         $button = new button('savecontext', $formButton);
     } else {
         $button = new button('savecontext', ucwords($this->objLanguage->code2Txt('mod_context_updatecontext', 'context', NULL, 'Update [-context-]')));
     }
     $button->setToSubmit();
     $table2->addCell($button->show(), NULL, NULL, NULL, NULL, 'colspan="2"');
     $table2->endRow();
     $form = new form('createcontext', $this->uri(array('action' => $this->formAction), $this->formModule));
     $form->addToForm($table2->show());
     if ($this->objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') {
         $form->addToForm($access->show());
     }
     if ($context != NULL) {
         $hiddenInput = new hiddeninput('contextcode', $context['contextcode']);
         $form->addToForm($hiddenInput->show());
     }
     $form->addRule('title', $this->objLanguage->code2Txt('mod_context_entertitleofcontext', 'context', NULL, 'Please enter the title of your [-context-]'), 'required');
     $str .= $form->show();
     return $str;
 }
Exemplo n.º 9
0
 /**
  *
  * Render a login box
  *
  * @param string $module The module we are in or will go to
  * @param boolean $ajaxLogin Whether or not to do ajax login
  * @return string The login box
  * @access public
  *
  */
 public function renderLoginBox($module = NULL, $ajaxLogin = FALSE)
 {
     try {
         // Determine if we need to use https
         $useHTTPS = $this->objSysConfig->getValue('MOD_SECURITY_HTTPS', 'security');
         // Set the formaction depending on whether it is going to use ajax or not.
         if (!$ajaxLogin) {
             // Set the action for the login form depending on if there is a module or not.
             if ($module != NULL) {
                 $formAction = $this->uri(array('action' => 'login', 'mod' => $module), 'security');
             } else {
                 $formAction = $this->uri(array('action' => 'login'), 'login');
             }
             if ($useHTTPS == '1' || $useHTTPS == 'TRUE') {
                 $formAction = str_replace("http:", "https:", $formAction);
             }
         } else {
             // We want an ajax login.
             $formAction = 'javascript:void(0);';
         }
         // Create a Form object.
         $objForm = new form('loginform', $formAction);
         $objFields = new fieldset();
         $objFields->setLegend(' ');
         //--Create an element for the username
         $objInput = new textinput('username', '', 'text', '15');
         $objInput->extra = 'maxlength="255"';
         $objInput->setCss('required minlength(2)');
         $objLabel = new label($this->objLanguage->languageText('word_username') . ': ', 'input_username');
         //Add the username box to the form
         $objFields->addContent($objLabel->show() . '<br />');
         $objFields->addContent($objInput->show() . '<br />');
         //--- Create an element for the password
         $objInput = new textinput('password', '', 'password', '15');
         $objInput->extra = 'maxlength="255"';
         $objInput->setCss('required');
         $objLabel = new label($this->objLanguage->languageText('word_password') . ': ', 'input_password');
         $objFields->addContent($objLabel->show() . '<br />');
         $objFields->addContent($objInput->show());
         //--- Create an element for the network login radio
         $objElement = new checkbox("useLdap");
         $objElement->setCSS("transparentbgnb");
         $objElement->label = $this->objLanguage->languageText("phrase_networkid") . ' ';
         $ldap = '';
         $objSysConfig = $this->getObject('dbsysconfig', 'sysconfig');
         $showLDAPCheckBox = $objSysConfig->getValue('show_ldap_checkbox', 'security');
         // Get a nonce
         $objNonce = $this->getObject('nonce', 'login');
         $nonce = $objNonce->storeNonce();
         // Create a hidden field for the nonce
         $objNonce = new hiddeninput('nonce', $nonce);
         $objNonce->extra = ' id=\'nonce\'';
         $nonce = $objNonce->show();
         //----------------------------------------------------------------------------------------Checking this is a violation of the principle of chain of responsiblity @todo fix it
         if ($this->objConfig->getuseLDAP() && $showLDAPCheckBox == 'true') {
             $ldap .= $objElement->label . ' ' . $objElement->show();
         }
         //--- Create an element for the remember me checkbox
         $objRElement = new checkbox("remember");
         $objRElement->setCSS("transparentbgnb noborder");
         $objRElement->label = $this->objLanguage->languageText("phrase_rememberme", "security");
         $rem = $objRElement->show() . "<br />";
         //--- Create a submit button
         $objButton = new button('submit', $this->objLanguage->languageText("word_login"));
         // Add the login icon
         $objButton->setIconClass("user");
         // Set the button type to submit
         $objButton->setToSubmit();
         // Give the button an ID for jQuery to grab.
         $objButton->setId('loginButton');
         // Add the button to the form ----------------------------------------------------------- Note LDAP breaks the COR pattern
         $objFields->addContent($ldap . '<br />' . $nonce . $rem . "<div class='loginbuttonwrap'>" . $objButton->show() . '</div>');
         $helpText = strtoupper($this->objLanguage->languageText('word_help', 'system'));
         $helpIcon = $this->objHelp->show('register', 'useradmin', $helpText);
         $resetLink = new Link($this->uri(array('action' => 'needpassword'), 'security'));
         $resetLink->link = $this->objLanguage->languageText('mod_security_forgotpassword');
         // the help link
         $p = '<br/>' . $resetLink->show() . '<br />' . $helpIcon;
         $objFields->addContent($p);
         $objForm->addToForm($objFields->show());
         return '<div id="login_block_wrapper">' . $objForm->show() . '</div>';
     } catch (Exception $e) {
         customException::cleanUp();
     }
 }
Exemplo n.º 10
0
 /**
  * Method to render a login box
  * @returns string
  */
 public function renderLoginBox($module = NULL)
 {
     try {
         //set the action for the login form
         if ($module != NULL) {
             $formAction = $this->objEngine->uri(array('action' => 'login', 'mod' => $module), 'security');
         } else {
             $formAction = $this->objEngine->uri(array('action' => 'login'), 'security');
         }
         $useHTTPS = $this->objSysConfig->getValue('MOD_SECURITY_HTTPS', 'security');
         if ($useHTTPS == '1') {
             $formAction = str_replace("http:", "https:", $formAction);
         }
         //Load up the various HTML classes
         $this->loadClass('button', 'htmlelements');
         $this->loadClass('textinput', 'htmlelements');
         $this->loadClass('checkbox', 'htmlelements');
         $this->loadClass('link', 'htmlelements');
         $this->loadClass('label', 'htmlelements');
         $this->loadClass('fieldset', 'htmlelements');
         $objBox = $this->newObject('alertbox', 'htmlelements');
         $objIcon = $this->getObject('geticon', 'htmlelements');
         // prepare the link for the oAuth providers
         $box = $this->oauthDisp();
         $fb = $this->fbButton();
         //fbConnect();
         // Create a Form object
         $objForm = new form('loginform', $formAction);
         $objFields = new fieldset();
         $objFields->setLegend(' ');
         //--Create an element for the username
         $objInput = new textinput('username', '', 'text', '15');
         $objInput->extra = 'maxlength="255" placeholder="' . $this->objLanguage->languageText('word_username', 'system') . '"';
         $objLabel = new label($this->objLanguage->languageText('word_username') . ': ', 'input_username');
         //Add validation for username
         $objForm->addRule('username', $this->objLanguage->languageText("mod_login_unrequired", 'security', 'Please enter a username. A username is required in order to login.'), 'required');
         //Add the username box to the form
         $this->objIcon->setIcon('user');
         $objFields->addContent($this->objIcon->show());
         $objFields->addContent($objInput->show() . '<br />');
         //$objForm->addToForm();
         //--- Create an element for the password
         $objInput = new textinput('password', '', 'password', '15');
         $objInput->extra = 'maxlength="255" placeholder="' . $this->objLanguage->languageText('word_password', 'system') . '"';
         $objLabel = new label($this->objLanguage->languageText('word_password') . ': ', 'input_password');
         //Add the password box to the form
         //$objForm->addToForm();
         $this->objIcon->setIcon('key');
         $objFields->addContent($this->objIcon->show());
         //                        $objFields->addContent($objLabel->show() . '<br />');
         $objFields->addContent($objInput->show());
         //--- Create an element for the network login radio
         $objElement = new checkbox("useLdap");
         $objElement->setCSS("transparentbgnb");
         $objElement->label = $this->objLanguage->languageText("phrase_networkid") . ' ';
         $ldap = '';
         $objSysConfig = $this->getObject('dbsysconfig', 'sysconfig');
         $showLDAPCheckBox = $objSysConfig->getValue('show_ldap_checkbox', 'security');
         if ($this->objConfig->getuseLDAP() && $showLDAPCheckBox == 'true') {
             $ldap .= $objElement->label . ' ' . $objElement->show();
         }
         //--- Create an element for the remember me checkbox
         $objRElement = new checkbox("remember");
         $objRElement->setCSS("transparentbgnb noborder");
         $objRElement->label = $this->objLanguage->languageText("phrase_rememberme", "security");
         $rem = $objRElement->show() . "<br />";
         //--- Create a submit button
         $objButton = new button('submit', $this->objLanguage->languageText("word_login"));
         // Add the login icon
         $objButton->setIconClass("user");
         // Set the button type to submit
         $objButton->setToSubmit();
         // Add the button to the form
         // openid / google /yahoo login
         // Open ID login code.
         $showOpenIdLogin = $objSysConfig->getValue('show_openidconnect_auth', 'security');
         $openidlink = "";
         if ($showOpenIdLogin == 'true') {
             // OpenId auth page is used for Google and Yahoo
             $objAltConfig = $this->getObject('altconfig', 'config');
             $siteRoot = $objAltConfig->getSiteRoot();
             $OPENID_AUTH_PAGE = $this->uri(array("action" => "openidconnect"), "security");
             // Google icon
             $gIcon = $this->newObject('geticon', 'htmlelements');
             $gIcon->setIcon('google');
             $gIcon->alt = "Google ID";
             $gIcon->extra = ' name="but_google" id="but_google2" onload="" ';
             // Facebook icon
             $fIcon = $this->newObject('geticon', 'htmlelements');
             $fIcon->setIcon('facebook');
             $fIcon->alt = "FB ID";
             $fIcon->extra = ' name="but_fb" id="but_fb" onload="" ';
             $FB_AUTH_PAGE = $this->uri(array("action" => "initfacebooklogin", 'auth_site' => 'facebook'), "security");
             // Yahoo icon
             $yIcon = $this->newObject('geticon', 'htmlelements');
             $yIcon->setIcon('yahoo');
             $yIcon->alt = "Yahoo ID";
             $yIcon->extra = ' name="but_yahoo" id="but_yahoo" onload="" ';
             //Twitter icon
             $tIcon = $this->newObject('geticon', 'htmlelements');
             $tIcon->setIcon('twitter', 'png');
             $tIcon->alt = "TWITTER ID";
             $tIcon->extra = ' name="but_twitter" id="but_twitter" onload="" ';
             $TWITTER_AUTH_PAGE = $this->uri(array("action" => "dotwitterlogin", 'auth_site' => 'twitter'), "security");
             $TWITTER_AUTH_PAGE = str_replace("&amp;", "&", $TWITTER_AUTH_PAGE);
             $openidloginlink = new link($this->uri(array("action" => "openidconnect"), "security"));
             $openidloginlink->link = '<h3>' . $this->objLanguage->languageText('mod_security_oauthheading', 'security') . '</h3>';
             $sitePath = $objAltConfig->getSitePath();
             // A google login icon linked to OpenID login with gooogle id.
             $googleTD = '<a href="' . $OPENID_AUTH_PAGE . '&auth_site=google" target="_top">' . $gIcon->show() . '</a>';
             // A Yahoo login icon linked to OpenId login with Yahoo ID.
             $yahooTD = '<a href="' . $OPENID_AUTH_PAGE . '&auth_site=yahoo" target="_top">' . $yIcon->show() . '</a>';
             // Facebook login icon with link to login page.
             $fbTD = '<a href="' . $FB_AUTH_PAGE . '" target="_top">' . $fIcon->show() . '</a>';
             // Twitter login icon with link to login page.
             $twitterTD = '<a href="' . $TWITTER_AUTH_PAGE . '" target="_top">' . $tIcon->show() . '</a>';
             //$twitterTD = NULL; <--- uncomment for commit until TWITTER AUTH is fixed
             // Explanation text for the textbox and Choose button
             $explainBox = '<div class="oid_explain">' . $this->objLanguage->languageText('mod_security_openidexplainbox', 'security') . '</div>';
             // Title for the fieldset.
             $title = '<h3>' . $this->objLanguage->languageText('mod_security_openidlogintitle', 'security') . '</h3>';
             $allowOpenIdForm = FALSE;
             if ($allowOpenIdForm) {
                 // Allow login via any Open ID url, use mainly for testing.
                 $openIdForm = new form('openlogiidnform', $this->uri(array("action" => "openidconnect", "auth_site" => "openid")));
                 $objInput = new textinput('openIDField', '', 'text', '30');
                 $objInput->extra = 'maxlength="255"';
                 $openIdForm->addToForm($explainBox . $objInput->show());
                 // The login via provided open ID URL button
                 $openIdButton = new button('submit', $this->objLanguage->languageText("mod_security_openidlogin", 'security'));
                 // Add the login icon
                 $openIdButton->setIconClass("user");
                 // Set the button type to submit
                 $openIdButton->setToSubmit();
                 $openIdForm->addToForm($openIdButton->show());
                 $opForm = '<hr/><br/>' . $openIdForm->show();
             } else {
                 $opForm = NULL;
             }
             $openIdFields = new fieldset();
             $openIdFields->setLegend('<h3>' . $title . '</h3>');
             $openIdFields->addContent($this->objLanguage->languageText('mod_security_oidliinstr', 'security', 'Login with one of the accounts indicated by the icons below'));
             $openIdFields->addContent('<hr>');
             $openIdFields->addContent($fbTD . '&nbsp;' . $twitterTD . '&nbsp;' . $googleTD . '&nbsp;' . $yahooTD . '&nbsp;' . $opForm);
             $openidlink = '<div class="openidlogin">' . $openIdFields->show() . "</div>";
         }
         $objFields->addContent($ldap . '<br />' . $rem . $box . "<div class='loginbuttonwrap'>" . $objButton->show() . '</div>' . $fb);
         $notice = $this->objLanguage->languageText('mod_security_forgotpassword');
         $helpText = strtoupper($this->objLanguage->languageText('mod_security_helpmelogin', 'security', 'Yes, please help me to login'));
         $resetLink = new Link($this->uri(array('action' => 'needpassword'), 'security'));
         $resetLink->link = $helpText;
         // the help link
         $p = '<br />' . $notice . '<br/>' . $resetLink->show() . '<br />';
         $objFields->addContent($p);
         $objForm->addToForm($objFields->show());
         return $objForm->show() . $openidlink;
     } catch (Exception $e) {
         customException::cleanUp();
     }
 }
Exemplo n.º 11
0
 /**
  * Short description for function
  *
  * Long description (if any) ...
  *
  * @return void
  * @access public
  */
 function showForms()
 {
     //Text Input
     $objForm = new form('testform');
     $url = $this->uri(array('action' => 'add'), 'htmlelements');
     $objForm->setAction($this->uri(array('action' => 'save'), 'htmlelements'));
     $objForm->setDisplayType(2);
     $objElement = new textinput('textbox');
     $objElement->setValue('Some text');
     $objElement->label = 'Textbox\'s label';
     $text = $objElement->show() . '<br />';
     $objForm->addToForm('<span class="warning">Start of Form</span><br />');
     $objForm->addToForm($objElement);
     //Calendar
     /*$objElement = new calendar('cal');
       $today = getdate();
       $objElement->setDate($today['mon'],$today['mday'],$today['year']);
       $calendar = $objElement->show().'<br />';*/
     //Radion button Group
     $objElement = new radio('sex_radio');
     $objElement->addOption('m', 'Male');
     $objElement->addOption('f', 'Female');
     $objElement->addOption('n', 'Seaweed');
     $objElement->setSelected('f');
     $radio = $objElement->show() . '<br />';
     //Check boxes
     $objElement = new checkbox('m', 'Male', true);
     $check = $objElement->show();
     $objElement = new checkbox('f', 'Female');
     $check .= $objElement->show();
     $objElement = new checkbox('n', 'Seawood');
     $check .= $objElement->show() . '<br />';
     //Dropdown
     $objElement = new dropdown('sex_dropdown');
     $objElement->addOption('', '');
     //adding a blank option
     $objElement->addOption('m', 'Male');
     $objElement->addOption('f', 'Female');
     $objElement->addOption('n', 'Seaweed');
     $objElement->setSelected('f');
     $dropdown = $objElement->show() . "<br />";
     //Dropdown created from array
     $objElement = new dropdown('user_dropdown');
     $objElement->addFromDB($this->objDBUser->getAll(), 'username', 'userid', $this->objDBUser->userName());
     $objElement->label = 'User list';
     $dropdown .= $objElement->show() . "<br />";
     //Textarea
     $objElement = new textarea('text_area');
     $objElement->setRows(3);
     $objElement->setColumns('45');
     $objElement->setContent('This is some content for the textarea');
     $ta = $objElement->show() . '<br />';
     //Button
     $objElement = new button('mybutton');
     $objElement->setValue('Normal Button');
     $objElement->setOnClick('alert(\'An onclick Event\')');
     $button = $objElement->show() . '<br />';
     //Submit Button
     $objElement = new button('mybutton');
     $objElement->setToSubmit();
     $objElement->label = 'Buttons Label';
     $objElement->setValue('Submit Button');
     $submit = $objElement->show() . '<br />';
     //add submit button to the form;
     $objForm->addToForm($objElement);
     $mouseoverpopup = new mouseoverpopup('this is some text');
     $mouseoverpopup = $mouseoverpopup->show();
     //Add all the above to a tabbedbox
     $objElement = new tabbedbox();
     $objElement->addTabLabel('Tabbed box 1');
     $objElement->addBoxContent($mouseoverpopup . $text . $dropdown . $button . $submit);
     $tab = '<br />' . $objElement->show() . '<br />';
     //add the tab to the form
     $objForm->addToForm($objElement);
     $objForm->addToForm('<span class="warning">End of Form</span>');
     $form = $objForm->show() . '<br />';
     //create a multitabbedbox
     $objElement = new multitabbedbox('100px', '500px');
     $objElement->addTab(array('name' => 'First', 'url' => 'http://localhost', 'content' => $form, 'default' => true));
     $objElement->addTab(array('name' => 'Second', 'url' => 'http://localhost', 'content' => $check . $radio));
     $objElement->addTab(array('name' => 'Third', 'url' => 'http://localhost', 'content' => $tab, 'height' => '300px', 'width' => '600px'));
     //$objElement->addTab(array('name'=>'Test Validation','url'=>'http://localhost','content' => $this->valFormShow(),'height' => '300','width' => '700'));
     //set layers
     $left = $tab;
     $content = 'This is an example using most of the classes in the htmlelements module<br />';
     $content .= '<br />' . $objElement->show();
     //this to make the centre layer strech downwards
     for ($i = 0; $i < 10; $i++) {
         $content .= '<br />';
     }
     $right = $tab;
     $bottom = $ta;
     $this->setVar('left', $left);
     $this->setVar('right', $right);
     $this->setVar('content', $content);
     $this->setVar('bottom', $bottom);
     //return $str;
 }
Exemplo n.º 12
0
$objTable->addRow(array($objLabel->show(), $objCheck->show()));
// Context dependent module
$objLabel = new label($dependsLabel, 'input_dependsContext');
$objCheck = new checkbox('dependsContext');
$objCheck->setChecked($depends);
$objTable->addRow(array($objLabel->show(), $objCheck->show()));
// Link Permissions
$objHead->str = $linkPermLabel;
$objHead->type = 3;
$objTable->startRow();
$objTable->addCell($objHead->show(), '', '', '', '', 'colspan="4"');
$objTable->endRow();
// set available to whole site
if (!$page) {
    $objLabel = new label($siteLabel, 'input_site');
    $objCheck = new checkbox('site');
    $objCheck->setChecked($allSite);
    $objTable->addRow(array($objLabel->show(), $objCheck->show()));
}
$objLink = new link('javascript:void(0)');
$objLink->link = $setPermLabel;
$objLink->extra = "onclick = \"javascript:window.open('" . $this->uri(array('action' => 'setperm', 'modulename' => $moduleName), '', '', TRUE) . "', 'setperms', 'width=800, height=600, scrollbars')\"";
$objTable->startRow();
$objTable->addCell($objLink->show(), '', '', '', '', 'colspan="2"');
$objTable->endRow();
$formElements = '';
// hidden elements: id, module, dependsContext, adminOnly
if ($mode == 'edit') {
    $objInput = new textinput('id', $data['id']);
    $objInput->fldType = 'hidden';
    $formElements .= $objInput->show();
Exemplo n.º 13
0
 /**
  * Method to generate a form with the
  * plugin modules on
  * @param string $contextCode
  *
  * @return string
  */
 public function getPluginForm($contextCode = NULL)
 {
     if (empty($contextCode)) {
         $contextCode = $this->_objDBContext->getContextCode();
     }
     $objForm = new form();
     $objFormMod = new form();
     $objH = new htmlheading();
     $inpContextCode = new textinput();
     $inpMenuText = new textinput();
     $objDBContextParams = $this->newObject('dbcontextparams', 'context');
     $featureBox = $this->getObject('featurebox', 'navigation');
     //list of modules for this context
     $arrContextModules = $this->_objContextModules->getContextModules($contextCode);
     $inpButton = new button();
     //setup the form
     $objForm->name = 'addfrm';
     $objForm->action = $this->uri(array('action' => 'savestep3'));
     $objForm->displayType = 3;
     $objFormMod->name = 'modfrm';
     $objFormMod->action = $this->uri(array('action' => 'savedefaultmod'));
     $objFormMod->displayType = 1;
     $inpAbout->name = 'about';
     $inpAbout->id = 'about';
     $inpAbout->value = '';
     $inpAbout->width = '20px';
     $inpButton->setToSubmit();
     $inpButton->cssClass = 'f-submit';
     $inpButton->value = ucwords($this->_objLanguage->languageText("word_save"));
     //validation
     //$objForm->addRule('about','About is a required field!', 'required');
     //$objForm->addToForm('<div class="req"><b>*</b> Indicates required field</div>');
     $objForm->addToForm('<fieldset>');
     $objForm->addToForm($objH->show());
     $objForm->addToForm('<div id="resultslist-wrap"><ol>');
     $objModuleFile = $this->newObject('modulefile', 'modulecatalogue');
     $objModules = $this->newObject('modules', 'modulecatalogue');
     $arrModules = $objModules->getModules(2);
     foreach ($arrModules as $module) {
         if ($objModuleFile->contextPlugin($module['module_id'])) {
             $checkbox = new checkbox('mod_' . $module['module_id']);
             $checkbox->value = $module['module_id'];
             $checkbox->cssId = 'mod_' . $module['module_id'];
             $checkbox->name = 'mod_' . $module['module_id'];
             $checkbox->cssClass = 'f-checkbox';
             foreach ($arrContextModules as $arr) {
                 if ($arr['moduleid'] == $module['module_id']) {
                     $checkbox->setChecked(TRUE);
                     break 1;
                 }
             }
             $icon = $this->newObject('geticon', 'htmlelements');
             $icon->setModuleIcon($module['module_id']);
             $objForm->addToForm('<ul><dt>' . $checkbox->show() . '&nbsp;' . $icon->show() . '&nbsp;' . ucwords($this->_objLanguage->code2Txt('mod_' . $module['module_id'] . '_name', $module['module_id'], array('context' => 'Course'))) . '</dt>');
             $objForm->addToForm('<dd  class="subdued">' . $this->_objLanguage->abstractText($module['description']) . '</dd>');
             $objForm->addToForm('</ul>');
         }
     }
     $objForm->addToForm('</ol></div><div class="f-submit-wrap">' . $inpButton->show() . '</div></fieldset>');
     $dropDefaultModule = new dropdown();
     $defaultmoduleid = $objDBContextParams->getParamValue($contextCode, 'defaultmodule');
     $drop = '<select id="defaultmodule" name="defaultmodule">';
     $drop .= '<option value="">' . $this->_objLanguage->languageText("mod_context_setdefaultmodule", 'context') . '</option>';
     //$inpButton->value = $this->_objLanguage->languageText("mod_context_setasdefaultmodule",'context');
     foreach ($arrContextModules as $mod) {
         $modInfo = $objModules->getModuleInfo($mod['moduleid']);
         $drop .= '<option value="' . $mod['moduleid'] . '"';
         $drop .= $defaultmoduleid == $mod['moduleid'] ? ' selected="selected" ' : '';
         $drop .= '>' . ucwords($modInfo['name']) . '</option>';
     }
     $drop .= '</select>';
     $drop = '<div style="width:270px">' . $drop . $inpButton->show() . '</div>';
     $objFormMod->addToForm($drop);
     $objFormMod->addToForm('<span class="subdued">' . $this->_objLanguage->code2Txt("mod_contextadmin_defaultmodhelp", 'context', array('context' => 'Course')) . '</span>');
     return $featureBox->show($this->_objLanguage->languageText("mod_context_setdefaultmodule", 'context'), $objFormMod->show()) . $featureBox->show('Plugin List', $objForm->show()) . '<br/>';
 }
Exemplo n.º 14
0
 $class = $count % 2 == 0 ? 'even' : 'odd';
 $count++;
 $desc = $this->objCatalogueConfig->getModuleDescription($moduleId);
 $status = $this->objCatalogueConfig->getModuleStatus($moduleId);
 if (isset($desc[0])) {
     $desc = (string) $desc[0];
 } else {
     $desc = $this->objLanguage->languageText('mod_modulecatalogue_nodesc', 'modulecatalogue');
 }
 $desc = $this->objLanguage->abstractText($desc);
 $objWasher = $this->getObject('bbcodeparser', 'utilities');
 $desc = $objWasher->parse4BBcode($desc);
 $infoButton =& new Link($this->uri(array('action' => 'info', 'mod' => $moduleId, 'cat' => $activeCat), 'modulecatalogue'));
 $infoButton->link = $this->objLanguage->languageText('mod_modulecatalogue_info2', 'modulecatalogue');
 $link = $moduleName = ucfirst($moduleName);
 $objCheck = new checkbox('arrayList[]');
 $objCheck->cssId = 'checkbox_' . $moduleId;
 $objCheck->setValue($moduleId);
 $objCheck->extra = 'onclick="javascript:toggleChecked(this);"';
 if ($this->objModFile->findRegisterFile($moduleId)) {
     //has regfile
     $texts = $textButton->show();
     $info = $infoButton->show();
     if (!in_array($moduleId, $rMods)) {
         //not registered
         $instButton =& new Link($this->uri(array('action' => 'install', 'mod' => $moduleId, 'cat' => $activeCat, 'srchstr' => $srchStr, 'srchtype' => $srchType, 'lastaction' => $lastAction), 'modulecatalogue'));
         $instButton->link = $this->objLanguage->languageText('word_install');
         $instButton->extra = "class=\"pseudobutton\"";
         $instButtonShow = $instButton->show();
         if (!$batchuninstall) {
             $checkBox = $objCheck->show();
Exemplo n.º 15
0
    $objTable->addCell('', 30, '', '', 'heading', '');
}
$objTable->addCell($this->objLanguage->languageText('word_userid'), 100, '', '', 'heading', '');
$objTable->addCell($this->objLanguage->languageText('mod_security_staffstudentnumber', 'security', 'Staff/Student Number'), 100, '', '', 'heading', '');
$objTable->addCell($this->objLanguage->languageText('word_title'), 30, '', '', 'heading', '');
$objTable->addCell($this->objLanguage->languageText('phrase_firstName'), '20%', '', '', 'heading', '');
$objTable->addCell($this->objLanguage->languageText('word_surname'), '20%', '', '', 'heading', '');
$objTable->addCell($this->objLanguage->languageText('phrase_emailaddress'), '', '', '', 'heading', '');
if ($this->isValid('removeuser') && count($guestDetails) > 0) {
    $objTable->addCell('', 30, '', '', 'heading', '');
}
$objTable->endRow();
if (count($guestDetails) > 0) {
    $objTable->row_attributes = 'onmouseover="this.className=\'tbl_ruler\';" onmouseout="this.className=\'none\'; "';
    foreach ($guestDetails as $guest) {
        $objCheck = new checkbox('guestId[]');
        $objCheck->value = $guest['userid'];
        $objTable->startRow();
        if ($this->isValid('removeallusers')) {
            //if($guest['userid'] != $this->userId){
            $objTable->addCell($objCheck->show());
            //}else{
            //    $objTable->addCell('');
            //}
        }
        $objTable->addCell($guest['userid']);
        $objTable->addCell($guest['staffnumber']);
        $objTable->addCell($guest['title']);
        $objTable->addCell($guest['firstname']);
        $objTable->addCell($guest['surname']);
        $objTable->addCell($guest['emailaddress']);
Exemplo n.º 16
0
}
$table->startRow();
$table->addCell($this->objLanguage->languageText('mod_contextadmin_comment', 'contextadmin', 'Comment'));
$table->addCell($showcomment->show() . " *" . $this->objLanguage->languageText('mod_contextadmin_comments', 'contextadmin', 'Enable or Disable users to post comments on page content'));
$table->endRow();
$table->startRow();
$table->addCell('&nbsp;');
$table->addCell('&nbsp;');
$table->endRow();
if ($objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'false') {
    $table->startRow();
    $table->addCell($this->objLanguage->languageText('word_access', 'system', 'Access'));
    $table->addCell($access->show());
    $table->endRow();
}
$emailAlert = new checkbox('emailalertopt', $this->objLanguage->languageText('mod_contextadmin_emailalertwhat', 'contextadmin', 'Send email alerts'), true);
// this will checked
if ($mode == 'add' && is_array($fixup)) {
    $emailAlert->setChecked($fixup['alerts']);
} elseif ($mode == 'add') {
    $emailAlert->setChecked('0');
} else {
    if ($mode == 'edit') {
        $emailAlert->setChecked($context['alerts']);
    }
}
$table->startRow();
$table->addCell($this->objLanguage->languageText('mod_contextadmin_emailalert', 'contextadmin', 'Alerts'));
$table->addCell($emailAlert->show());
$table->endRow();
$button = new button('savecontext', $this->objLanguage->languageText('mod_contextadmin_gotonextstep', 'contextadmin', 'Go to Next Step'));
Exemplo n.º 17
0
$header->type = 1;
$header->str = $headerTitle;
echo '<br />' . $header->show();
echo '<p>' . $this->objLanguage->code2Txt('mod_context_selectcontextpluginsabs', 'context', array('plugins' => 'plugins'), 'Select the [-plugins-] you would like to use in your [-context-]') . ':</p>';
$form = new form('updateplugins', $this->uri(array('action' => 'savestep4')));
$table = $this->newObject('htmltable', 'htmlelements');
$objIcon = $this->newObject('geticon', 'htmlelements');
$counter = 0;
$newPlugins = array();
foreach ($plugins as $plugin) {
    $newPlugins[$plugin['title']] = $plugin;
}
ksort($newPlugins);
foreach ($newPlugins as $plugin) {
    $counter++;
    $checkbox = new checkbox('plugins[]');
    $checkbox->setValue($plugin['module_id']);
    $checkbox->setId('module_' . $plugin['module_id']);
    if (in_array($plugin['module_id'], $contextModules)) {
        $checkbox->setChecked(TRUE);
    }
    $objIcon->setModuleIcon($plugin['module_id']);
    if ($counter % 2 == 1) {
        $table->startRow();
    }
    $table->addCell($checkbox->show(), 20);
    $label = new label($objIcon->show(), 'module_' . $plugin['module_id']);
    $table->addCell($label->show(), 30);
    $label = new label('<strong>' . $plugin['title'] . '</strong><br />' . $plugin['description'], 'module_' . $plugin['module_id']);
    $table->addCell($label->show() . '<br /><br />');
    if ($counter % 2 == 2) {
Exemplo n.º 18
0
 /**
  * Creates  form that allows user to enable/disable alerts on folder changes.
  * These alerts include adding/deleting/renaming and generally any changes on
  * the file/folder
  * @param type $id
  * @return type 
  */
 function createAlertsForm($id)
 {
     $dbFolder = $this->getObject("dbfolder", "filemanager");
     $folder = $dbFolder->getFolder($id);
     //mod_filemanager_alertchangesonfolder
     $form = new form('accessform', $this->uri(array('action' => 'setfolderalerts')));
     $legend = $this->objLanguage->languageText('mod_filemanager_alerts', 'filemanager');
     $objElement = new checkbox('alerts', $this->objLanguage->languageText('mod_filemanager_alertchangesonfolder', 'filemanager'), false);
     $alertVal = null;
     if (key_exists("alerts", $folder)) {
         $alertVal = $folder['alerts'];
     }
     $alerts = $alertVal == NULL ? false : $folder['alerts'] == 'y' ? true : false;
     $objElement->setChecked($alerts);
     $applyButton = new button('apply', $this->objLanguage->languageText('mod_filemanager_apply', 'filemanager'));
     $applyButton->setToSubmit();
     $fieldset = new fieldset();
     $fieldset->setLegend($legend);
     $fieldset->addContent($objElement->show() . '<br/>' . $applyButton->show());
     $hiddeninput = new hiddeninput('id', $id);
     $form->addToForm($hiddeninput->show());
     $form->addToForm($fieldset->show());
     return $form->show();
 }
Exemplo n.º 19
0
$newfield->rows = 5;
$newfield->add();
$newfield = new radio();
$newfield->field = "Fradio";
$newfield->label = "Radio Bouton";
$newfield->multiLang = true;
$newfield->disabled = false;
$newfield->tooltip = "tooltip";
$newfield->value = array("fr" => "bb", "en" => "cc");
$newfield->defaultValue = array("fr" => "cc", "en" => "dd");
$newfield->valuesDisabled = array("aa");
$newfield->items = array("aa" => "AAAA", "bb" => "BBBB", "cc" => "CCCC", "dd" => "DDDD");
$newfield->noneItem = true;
$newfield->allItems = "all Items";
$newfield->add();
$newfield = new checkbox();
$newfield->field = "Fcheckbox";
$newfield->label = "Check box";
$newfield->multiLang = true;
$newfield->disabled = false;
$newfield->tooltip = "tooltip";
$newfield->value = array("fr" => "aa,bb", "en" => "cc");
$newfield->defaultValue = array("fr" => "cc", "en" => "dd");
$newfield->valuesDisabled = array("dd");
$newfield->items = array("aa" => "AAAA", "bb" => "BBBB", "cc" => "CCCC", "dd" => "DDDD");
//$newfield->noneItem=true;
//$newfield->allItems="all Items";
$newfield->add();
$newfield = new select();
$newfield->field = "Fselect";
$newfield->label = "Select";
Exemplo n.º 20
0
    /**
     * Short description for function
     *
     * Long description (if any) ...
     *
     * @param  array  $subFolders Parameter description (if any) ...
     * @param  array  $files      Parameter description (if any) ...
     * @return object Return description (if any) ...
     * @access public
     */
    function previewLongView($subFolders, $files, $symlinks, $restriction, $mode, $name, $forceRestriction = FALSE)
    {
        $objTable = $this->newObject('htmltable', 'htmlelements');
        $objFilePreview = $this->getObject('filepreview');
        $objFileSize = new formatfilesize();
        $objThumbnail = $this->getObject('thumbnails', 'filemanager');
        if ($this->viewType == strtolower('thumbnails')) {
            $objTable->cssId = $this->objLanguage->languageText('mod_filemanager_filemanagertableclass', 'filemanager', 'filemanagerTable');
            $this->objFileIcons->size = 'large';
        }
        $objIcon = $this->newObject('geticon', 'htmlelements');
        if ($this->editPermission) {
            if ($this->viewType != strtolower('thumbnails')) {
                $objTable->startHeaderRow();
                $objTable->addHeaderCell('&nbsp;', '20');
            }
        }
        if ($this->viewType != strtolower('thumbnails')) {
            $objTable->addHeaderCell('&nbsp;', '20');
            $objTable->addHeaderCell($this->objLanguage->languageText('word_name', 'system', 'Name'));
            $objTable->addHeaderCell($this->objLanguage->languageText('word_size', 'system', 'Size'), 60);
            $objTable->addHeaderCell('&nbsp;', '30');
        }
        // Set Restriction as empty if it is none
        if (count($restriction) == 1 && $restriction[0] == '') {
            $restriction = array();
        }
        $objTable->endHeaderRow();
        $hidden = 0;
        if (count($subFolders) == 0 && count($files) == 0 && count($symlinks) == 0) {
            $objTable->startRow();
            $objTable->addCell('<em>' . $this->objLanguage->languageText('mod_filemanager_nofilesorfolders', 'filemanager', 'No files or folders found') . '</em>', NULL, NULL, NULL, 'noRecordsMessage', 'colspan="5"');
            $objTable->endRow();
        } else {
            if (count($subFolders) > 0) {
                $folderIcon = $this->objFileIcons->getExtensionIcon('folder');
                foreach ($subFolders as $folder) {
                    $this->domDoc = new DOMDocument('utf-8');
                    $domElements['viewDiv'] = $this->domDoc->createElement('div');
                    $domElements['viewDiv']->setAttribute('class', 'fm_thumbnails');
                    $domElements['folderLink'] = $this->domDoc->createElement('a');
                    //The DOM icon folder
                    $domElements['folderIcon'] = $this->domDoc->createElement('img');
                    $domElements['folderIcon']->setAttribute('src', $this->objFileIcons->getIconSrc('folder'));
                    $domElements['folderIcon']->setAttribute('class', 'iconThumbnail');
                    $domElements['folderLink']->setAttribute('title', $this->objLanguage->languageText('mod_filemanager_clicktoopen', 'filemanager'));
                    $domElements['folderLink']->setAttribute('href', str_replace('amp;', '', $this->uri(array('action' => 'viewfolder', 'folder' => $folder['id'], 'view' => $this->viewType), $this->targetModule)));
                    $objTable->startRow();
                    if ($this->editPermission) {
                        $checkbox = new checkbox('files[]');
                        $checkbox->value = 'folder__' . $folder['id'];
                        $checkbox->cssId = htmlentities('input_files_' . basename($folder['folderpath']));
                        //The DOM folder checkbox
                        $domElements['folderCheckbox'] = $this->domDoc->createElement('input');
                        $domElements['folderCheckbox']->setAttribute('type', 'checkbox');
                        $domElements['folderCheckbox']->setAttribute('name', 'files[]');
                        $domElements['folderCheckbox']->setAttribute('id', htmlentities('input_files_' . basename($folder['folderpath'])));
                        $domElements['folderCheckbox']->setAttribute('value', 'folder__' . $folder['id']);
                        $domElements['folderCheckbox']->setAttribute('class', 'transparentbgnb');
                        //Delete confirm object
                        $delConfirm = $this->getObject('confirm', 'utilities');
                        //Setting the confirmation message
                        $delConfirm->setConfirm(NULL, str_replace('amp;', '', $this->uri(array('action' => 'deletefolder', 'id' => $folder['id'], 'module' => $this->targetModule))), $this->objLanguage->languageText('mod_filemanager_areyousuredeletefiles', 'filemanager'), NULL);
                        //The DOM delete link
                        $domElements['deleteconfirm'] = $this->domDoc->createElement('a');
                        $domElements['deleteconfirm']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText('word_delete', 'system')));
                        $domElements['deleteconfirm']->setAttribute('class', $this->objLanguage->languageText('mod_filemanager_buttonlinkclass', 'filemanager'));
                        $domElements['deleteconfirm']->setAttribute('href', $delConfirm->href);
                        $domElements['viewDiv']->appendChild($domElements['folderCheckbox']);
                        $domElements['viewDiv']->appendChild($domElements['deleteconfirm']);
                        $domElements['viewDiv']->appendChild($this->domDoc->createElement('br'));
                        if ($this->viewType != strtolower('thumbnails')) {
                            $objTable->addCell($checkbox->show());
                        }
                    }
                    //The value to appear when the mouse is over the link
                    $domElements['folderParagraph'] = $this->domDoc->createElement('p');
                    $domElements['folderParagraph']->setAttribute('class', 'folderdetails');
                    $domElements['folderParagraph']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText("phrase_foldername", "system") . ": " . substr(basename($folder['folderpath']), 0, 12)));
                    $domElements['folderParagraph']->appendChild($this->domDoc->createElement('br'));
                    $domElements['folderParagraph']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText("word_files", "system") . ": " . count($this->objFiles->getFolderFiles($folder['folderpath']))));
                    $domElements['folderParagraph']->appendChild($this->domDoc->createElement('br'));
                    $domElements['folderParagraph']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText("word_folders", "system") . ": " . count($this->objFolder->getSubFolders($folder['id']))));
                    //creating space between the link at the top and the string below
                    $domElements['viewDiv']->appendChild($this->domDoc->createElement('p'));
                    $domElements['folderLink']->appendChild($domElements['folderIcon']);
                    $domElements['folderLink']->appendChild($domElements['folderParagraph']);
                    $domElements['viewDiv']->appendChild($this->domDoc->createElement('br'));
                    $domElements['viewDiv']->appendChild($domElements['folderLink']);
                    if ($this->viewType != strtolower('thumbnails')) {
                        $objTable->addCell($folderIcon);
                    }
                    $folderLink = new link($this->uri(array('action' => 'viewfolder', 'folder' => $folder['id'], 'view' => $this->viewType), $this->targetModule));
                    $extTitle = '';
                    $accessVal = null;
                    if (key_exists("access", $folder)) {
                        $accessVal = $folder['access'];
                    }
                    if ($accessVal == 'private_all') {
                        $objIcon->setIcon('info');
                        $extTitle = $objIcon->show();
                        $domElements['folderParagraph']->appendChild($this->domDoc->createElement('br'));
                        $domElements['folderParagraph']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText('word_access', 'system') . ': '));
                        $domElements['folderParagraph']->appendChild($this->domDoc->createTextNode($folder['access']));
                    }
                    //TODO: make this a reusable function
                    //variables to store informatin partaining folder contants
                    $nmbrOfFiles = count($this->objFiles->getFolderFiles($folder['folderpath']));
                    $nmbrOfFolders = count($this->objFolder->getSubFolders($folder['id']));
                    //Assign the value to be displayed on the link's title depending on it's contents
                    if ($nmbrOfFiles == 0 && $nmbrOfFolders == 0) {
                        $titleString = $this->objLanguage->languageText("mod_filemanager_emptyfolderindicator", "filemanager");
                    } else {
                        $titleString = $this->objLanguage->languageText("mod_filemanager_contentsindicator", "filemanager");
                        $titleString = substr($titleString, 0, 9) . $nmbrOfFolders . substr($titleString, 8, 11) . $nmbrOfFiles . substr($titleString, 18, 12);
                    }
                    //End subfolder and files count
                    $folderLink->title = $titleString;
                    $folderLink->link = substr(basename($folder['folderpath']), 0, 70) . '...' . $extTitle;
                    if ($this->viewType == strtolower('thumbnails')) {
                        $objTable->addCell($this->domDoc->saveHTML($domElements['viewDiv']));
                    } else {
                        $objTable->addCell($folderLink->show());
                        $objTable->addCell('<em>' . $this->objLanguage->languageText('word_folder', 'system', 'Folder') . '</em>');
                        $objTable->endRow();
                    }
                }
            }
            if (is_array($symlinks)) {
                $files = array_merge($files, $symlinks);
            }
            if (count($files) > 0) {
                //var_dump($files);
                $fileSize = new formatfilesize();
                foreach ($files as $file) {
                    $this->domDoc = new DOMDocument('utf-8');
                    $domElements['viewDiv'] = $this->domDoc->createElement('div');
                    $domElements['viewDiv']->setAttribute('class', 'fm_thumbnails');
                    $visibility = null;
                    if (key_exists("visibility", $file)) {
                        $visibility = $file['visibility'];
                    } else {
                        $file['visibility'] = 'visible';
                    }
                    $showFile = true;
                    if ($visibility == 'hidden') {
                        if ($file['creatorid'] == $this->objUser->userid()) {
                            $showFile = true;
                        } else {
                            $showFile = false;
                        }
                    }
                    if (!$showFile) {
                        continue;
                    }
                    if (count($restriction) > 0) {
                        if (!in_array(strtolower($file['datatype']), $restriction)) {
                            $objTable->startRow('hidefile');
                            $hidden++;
                        } else {
                            $objTable->startRow();
                        }
                    } else {
                        $objTable->startRow();
                    }
                    if ($this->editPermission) {
                        $checkbox = new checkbox('files[]');
                        //DOM checkbox
                        $domElements['checkbox'] = $this->domDoc->createElement('input');
                        $domElements['checkbox']->setAttribute('type', 'checkbox');
                        $domElements['checkbox']->setAttribute('name', 'files[]');
                        //DOM link
                        $domElements['editLink'] = $this->domDoc->createElement('a');
                        $domElements['editLink']->setAttribute('title', $this->objLanguage->languageText('mod_filemanager_clicktoedit', 'filemanager'));
                        $domElements['editLink']->setAttribute('href', str_replace('amp;', '', $this->uri(array('action' => 'editfiledetails', 'id' => $file['id']), $this->targetModule)));
                        if (isset($file['symlinkid'])) {
                            $domElements['checkbox']->setAttribute('value', 'symlink_' . $file['symlinkid']);
                            $checkbox->value = 'symlink__' . $file['symlinkid'];
                        } else {
                            $checkbox->value = $file['id'];
                            $domElements['checkbox']->setAttribute('value', $file['id']);
                        }
                        $checkbox->cssId = htmlentities('input_files_' . $file['filename']);
                        if ($this->viewType != strtolower('thumbnails')) {
                            $objTable->addCell($checkbox->show());
                        } else {
                            $domElements['checkbox']->setAttribute('id', htmlentities('input_files_' . $file['filename']));
                            $domElements['viewDiv']->appendChild($domElements['checkbox']);
                            $domElements['editLink']->setAttribute('class', $this->objLanguage->languageText("mod_filemanager_buttonlinkclass", "filemanager"));
                            $domElements['editLink']->appendChild($this->domDoc->createTextNode(substr($this->objLanguage->languageText("word_edit", "system"), 0, 4)));
                            $domElements['viewDiv']->appendChild($domElements['editLink']);
                            //Add the line separator
                            $domElements['viewDiv']->appendChild($this->domDoc->createTextNode(' | '));
                        }
                    }
                    $label = new label($this->objFileIcons->getFileIcon($file['filename']), htmlentities('input_files_' . $file['filename']));
                    if ($this->viewType != strtolower('thumbnails')) {
                        $objTable->addCell($label->show());
                    }
                    if (isset($file['symlinkid'])) {
                        $fileLink = new link($this->uri(array('action' => 'symlink', 'id' => $file['symlinkid'])));
                        //The DOM file link
                        $domElements['fileLink'] = $this->domDoc->createElement('a');
                        $domElements['fileLink']->setAttribute('href', str_replace('amp;', '', $this->uri(array('action' => 'symlink', 'id' => $file['symlinkid']))));
                    } else {
                        $fileLink = new link($this->uri(array('action' => 'fileinfo', 'id' => $file['id']), $this->targetModule));
                        //The DOM file link
                        $domElements['fileLink'] = $this->domDoc->createElement('a');
                        $domElements['fileLink']->setAttribute('class', 'fileLink');
                        $domElements['fileLink']->setAttribute('href', str_replace('amp;', '', $this->uri(array('action' => 'fileinfo', 'id' => $file['id']), $this->targetModule)));
                    }
                    //The DOM image paragraph (to display image file information)
                    $domElements['imgParagraph'] = $this->domDoc->createElement('p');
                    $domElements['imgParagraph']->setAttribute('class', 'filedetails');
                    $linkTitle = '';
                    $access = null;
                    if (key_exists("access", $file)) {
                        $access = $file['access'];
                    } else {
                        $file['access'] = 'public';
                    }
                    $domElements['fileLink']->setAttribute('title', $this->objLanguage->languageText('mod_filemanager_clicktoviewinfo', 'filemanager'));
                    //The DOM download link
                    $domElements['downloadLink'] = $this->domDoc->createElement('a');
                    $domElements['downloadLink']->setAttribute('title', $this->objLanguage->languageText('mod_filemanager_clicktodownload', 'filemanager'));
                    $domElements['downloadLink']->setAttribute('href', $this->objCleanUrl->cleanUpUrl($this->objAltConfig->getcontentPath() . $file['path']));
                    $domElements['downloadLink']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText("word_download", "system")));
                    $domElements['downloadLink']->setAttribute('class', $this->objLanguage->languageText("mod_filemanager_buttonlinkclass", "filemanager"));
                    $domElements['viewDiv']->appendChild($domElements['downloadLink']);
                    //creating space between the links at the top and the string below
                    $domElements['viewDiv']->appendChild($this->domDoc->createElement('br'));
                    $filepath = $this->objAltConfig->getSiteRoot() . '/usrfiles/' . $file['path'];
                    $fileType = $this->getObject("fileparts", "files");
                    $domElements['detailsDiv'] = $this->domDoc->createElement('div');
                    $domElements['imgDiv'] = $this->domDoc->createElement('div');
                    $domElements['imgDiv']->setAttribute('class', 'imageDiv');
                    $domElements['imgParagraph']->appendChild($this->domDoc->createElement('br'));
                    $domElements['imgParagraph']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText("word_filename", "system") . ": " . substr($file['filename'], 0, 10)));
                    //new line
                    $domElements['imgParagraph']->appendChild($this->domDoc->createElement('br'));
                    $domElements['imgParagraph']->appendChild($this->domDoc->createtextNode($this->objLanguage->languageText("phrase_filesize", "system") . ": " . $objFileSize->formatsize($file['filesize'])));
                    //new line
                    $domElements['imgParagraph']->appendChild($this->domDoc->createElement('br'));
                    $domElements['imgParagraph']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText("phrase_filetype") . ": " . $fileType->getExtension($file['filename'])));
                    //new line
                    $domElements['imgParagraph']->appendChild($this->domDoc->createElement('br'));
                    $domElements['imgParagraph']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText("phrase_dateuploaded", "system") . ": " . $file['datecreated']));
                    if ($access == 'private_all') {
                        $domElements['imgParagraph']->appendChild($this->domDoc->createElement('br'));
                        $domElements['imgParagraph']->appendChild($this->domDoc->createTextNode(ucfirst($this->objLanguage->languageText('word_access', 'system')) . ': '));
                        $domElements['imgParagraph']->appendChild($this->domDoc->createTextNode($folder['access']));
                        $domElements['viewDiv']->setAttribute('id', $file['access']);
                        $objIcon->setIcon('info');
                        $linkTitle = basename($file['filename']) . $objIcon->show();
                    } else {
                        $linkTitle = basename($file['filename']);
                    }
                    // get image thumbnails
                    //The DOM image
                    $domElements['image'] = $this->domDoc->createElement('img');
                    if (ereg("image", $file['mimetype']) || ereg("video", $file['mimetype'])) {
                        $domElements['image']->setAttribute('src', str_replace('amp;', '', $objThumbnail->getThumbnail($file['id'], $file['filename'], $this->objCleanUrl->cleanUpUrl($this->objAltConfig->getcontentPath() . $file['path']), 'large')));
                        $domElements['image']->setAttribute('class', 'imgThumbnail');
                        $domElements['imgDiv']->appendChild($domElements['image']);
                        $domElements['detailsDiv']->appendChild($domElements['imgParagraph']);
                    }
                    //create audio/video player object
                    $objPlayer = "";
                    if (ereg("audio", $file['mimetype'])) {
                        $objPlayer = $objFilePreview->previewFile($file['id']);
                        $domElements['viewDiv']->appendChild($domElements['fileLink']);
                        $domElements['imgParagraph']->removeAttribute('class');
                        $domElements['detailsDiv']->appendChild($domElements['imgParagraph']);
                    }
                    //other formats
                    if (!ereg("audio", $file['mimetype']) && !ereg("image", $file['mimetype']) && !ereg("video", $file['mimetype'])) {
                        $domElements['image']->setAttribute('src', $this->objFileIcons->getIconSrc($file['datatype']));
                        $domElements['image']->setAttribute('class', 'iconThumbnail');
                        $domElements['image']->normalize();
                        $domElements['imgDiv']->appendChild($domElements['image']);
                        $domElements['detailsDiv']->appendChild($domElements['imgParagraph']);
                    }
                    $domElements['fileLink']->appendChild($domElements['detailsDiv']);
                    $domElements['fileLink']->appendChild($domElements['imgDiv']);
                    $domElements['viewDiv']->appendChild($domElements['fileLink']);
                    $fileLink->link = $linkTitle;
                    $folderAccessObj = $this->getObject("folderaccess");
                    $filepath = $this->objAltConfig->getSiteRoot() . '/usrfiles/' . $file['path'];
                    //// $filePreviewObj->previewFile($file['id']);
                    //$this->uri(array("action" => "downloadsecurefile", "path" => $file['path'], "filename" => $file['filename']));
                    // echo "rssult == ". $folderAccessObj->isFileAccessPrivate($file);
                    // die();
                    if ($folderAccessObj->isFileAccessPrivate($file)) {
                        $filepath = $this->objAltConfig->getSiteRoot() . "index.php?module=filemanager&action=file&id=" . $file['id'] . '&filename=' . $file['filename'];
                    }
                    $selectStr = '<a href=\'javascript:selectFile("' . $filepath . '");\'>' . basename($file['filename']) . '</a>';
                    $selectFileStr = '<a href=\'javascript:selectFileWindow("' . $name . '","' . $file['filename'] . '","' . $file['id'] . '");\'>' . basename($file['filename']) . '</a>';
                    $selectImageStr = '<a href=\'javascript:selectImageWindow("' . $name . '", "' . $filepath . '","' . $file['filename'] . '","' . $file['id'] . '");\'>' . basename($file['filename']) . '</a>';
                    if ($mode == 'fckimage' || $mode == 'fckflash' || $mode == 'fcklink') {
                        if ($this->viewType != strtolower('thumbnails')) {
                            $objTable->addCell($selectStr);
                        } else {
                            //Disable file preview
                            $domElements['fileLink']->removeAttribute('href');
                            //remove the title string as the option will not be possible
                            $domElements['fileLink']->removeAttribute('title');
                            //The DOM select string
                            $domElements['selectStr'] = $this->domDoc->createElement('a');
                            $domElements['selectStr']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText('word_select', 'system')));
                            $domElements['selectStr']->setAttribute('href', 'javascript:selectFile("' . $filepath . '");');
                            $domElements['selectStr']->setAttribute('class', $this->objLanguage->languageText('mod_filemanager_buttonlinkclass', 'filemanager'));
                            $domElements['viewDiv']->appendChild($domElements['selectStr']);
                            $objTable->addCell($this->domDoc->saveHTML($domElements['viewDiv']) . $objPlayer);
                        }
                    } else {
                        if ($mode == 'selectfilewindow') {
                            if ($this->viewType != strtolower('thumbnails')) {
                                $objTable->addCell($selectFileStr);
                            } else {
                                $domElements['fileLink']->removeAttribute('href');
                                //remove the title string as the option will not be possible
                                $domElements['fileLink']->removeAttribute('title');
                                //The DOM select file string
                                $domElements['selectFileStr'] = $this->domDoc->createElement('a');
                                $domElements['selectFileStr']->setAttribute('href', 'javascript:selectFileWindow("' . $name . '","' . $file['filename'] . '","' . $file['id'] . '");');
                                $domElements['selectFileStr']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText('word_select', 'system')));
                                $domElements['selectFileStr']->setAttribute('class', $this->objLanguage->languageText('mod_filemanager_buttonlinkclass', 'filemanager'));
                                $domElements['viewDiv']->appendChild($domElements['selectFileStr']);
                                $objTable->addCell($this->domDoc->saveHTML($domElements['viewDiv']) . $objPlayer);
                            }
                        } else {
                            if ($mode == 'selectimagewindow') {
                                if ($this->viewType != strtolower('thumbnails')) {
                                    $objTable->addCell($selectImageStr);
                                } else {
                                    $domElements['fileLink']->removeAttribute('href');
                                    //remove the title string as the option will not be possible
                                    $domElements['fileLink']->removeAttribute('title');
                                    //The DOM image select link
                                    $domElements['imageSelect'] = $this->domDoc->createElement('a');
                                    $domElements['imageSelect']->setAttribute('href', 'javascript:selectImageWindow("' . $name . '","' . $filepath . '","' . $file['filename'] . '","' . $file['id'] . '");');
                                    $domElements['imageSelect']->appendChild($this->domDoc->createTextNode($this->objLanguage->languageText('word_select', 'system')));
                                    $domElements['imageSelect']->setAttribute('class', $this->objLanguage->languageText('mod_filemanager_buttonlinkclass', 'filemanager'));
                                    $domElements['viewDiv']->appendChild($domElements['imageSelect']);
                                    $objTable->addCell($this->domDoc->saveHTML($domElements['viewDiv']) . $objPlayer);
                                }
                            } else {
                                if ($this->viewType == strtolower('thumbnails')) {
                                    //return the document with all available objects and elements
                                    $objTable->addCell($this->domDoc->saveHTML($domElements['viewDiv']) . $objPlayer);
                                } else {
                                    $objTable->addCell($fileLink->show());
                                }
                            }
                        }
                    }
                    if ($this->viewType != strtolower('thumbnails')) {
                        $objTable->addCell($fileSize->formatsize($file['filesize']));
                    } else {
                        $objTable->endRow();
                    }
                }
            }
        }
        if ($hidden > 0 && count($restriction) > 0) {
            $str = '';
            if ($this->viewType == strtolower('thumbnails')) {
                $str .= '<style type="text/css">
#filemanagerTable tr.hidefile {display:none;}
</style>';
            } else {
                $str .= '<style type="text/css">
 tr.hidefile {display:none;}
</style>';
            }
            $str .= $this->objLanguage->languageText('mod_filemanager_browsingfor', 'filemanager', 'Browsing for') . ': ';
            $comma = '';
            foreach ($restriction as $restrict) {
                $str .= $comma . $restrict;
                $comma = ', ';
            }
            if (!$forceRestriction) {
                if ($this->viewType == strtolower('thumbnails')) {
                    $str .= '<script type="text/javascript">
var onOrOff = "off";
function turnOnFiles(value)
{
    if (onOrOff == \'off\') {
        jQuery(\'#filemanagerTable tr.hidefile\').each(function (i) {
            this.style.display = \'inline-block\';
        });
        adjustLayout();
        onOrOff = "on";
    } else {
        jQuery(\'#filemanagerTable tr.hidefile\').each(function (i) {
            this.style.display = \'none\';
        });
        adjustLayout();
        onOrOff = "off";
    }
}
</script>';
                } else {
                    $str .= '<script type="text/javascript">
var onOrOff = "off";
function turnOnFiles(value)
{
    if (onOrOff == \'off\') {
        jQuery(\'tr.hidefile\').each(function (i) {
            this.style.display = \'table-row\';
        });
        adjustLayout();
        onOrOff = "on";
    } else {
        jQuery(\'tr.hidefile\').each(function (i) {
            this.style.display = \'none\';
        });
        adjustLayout();
        onOrOff = "off";
    }
}
</script>';
                }
                $str .= ' &nbsp; - ';
                $this->loadClass('checkbox', 'htmlelements');
                $this->loadClass('label', 'htmlelements');
                $checkbox = new checkbox('showall');
                $checkbox->extra = ' onclick="turnOnFiles();"';
                $label = new label($this->objLanguage->languageText('mod_filemanager_showallfiles', 'filemanager', 'Show All Files'), $checkbox->cssId);
                $str .= $checkbox->show() . $label->show();
            }
        } else {
            $str = '';
        }
        return $str . $objTable->show() . $this->getJavascriptFile('thumbnails.js', 'filemanager');
    }
Exemplo n.º 21
0
    echo '<a href="' . $this->uri(NULL) . '">' . $this->objLanguage->languageText('mod_filemanager_returntofilemanager', 'filemanager', 'Return to File Manager') . '</a></p>';
} else {
    $files = $this->getParam('files');
    $form = new form('confirmsymlink', $this->uri(array('action' => 'symlinkconfirm')));
    $folderIcon = $this->objFileIcons->getExtensionIcon('folder');
    $form->addToForm('<ul>');
    $counter = 0;
    $folderCounter = 0;
    foreach ($files as $file) {
        if (substr($file, 0, 8) == 'folder__') {
            $folderCounter++;
        } else {
            $fileDetails = $this->objFiles->getFile($file);
            if ($fileDetails != FALSE) {
                $counter++;
                $checkbox = new checkbox('files[]', htmlentities($fileDetails['filename']), TRUE);
                $checkbox->value = $file;
                $form->addToForm('<li>' . $checkbox->show() . ' ' . htmlentities($fileDetails['filename']) . '</li>');
            }
        }
    }
    $form->addToForm('</ul>');
    $form->addToForm($this->objFolders->getTree('context', $this->contextCode, 'htmldropdown'));
    $button = new button('submitform', $this->objLanguage->code2Txt('mod_filemanager_attachtocontext', 'filemanager', NULL, 'Attach to [-context-]'));
    $button->setToSubmit();
    $form->addToForm('<br />' . $button->show());
    $folderInput = new hiddeninput('folder', $this->getParam('folder'));
    $this->setVar('folderId', $this->getParam('folder'));
    $form->addToForm($folderInput->show());
    if ($counter > 0) {
        echo '<h1>' . $this->objLanguage->code2Txt('mod_filemanager_attachtocontext', 'filemanager', NULL, 'Attach to [-context-]') . '?</h1>';
Exemplo n.º 22
0
    $objDrop->setSelected($cat);
}
$objTable->addRow(array($objLabel->show(), $objDrop->show()));
$objHead->str = $settingsLabel;
$objHead->type = 3;
$objTable->startRow();
$objTable->addCell($objHead->show(), '', '', '', '', 'colspan="4"');
$objTable->endRow();
// Admin only module
$objLabel = new label($adminLabel, 'input_adminOnly');
$objCheck = new checkbox('adminOnly');
$objCheck->setChecked($adminOnly);
$objTable->addRow(array($objLabel->show(), $objCheck->show()));
// Context dependent module
$objLabel = new label($dependsLabel, 'input_dependsContext');
$objCheck = new checkbox('dependsContext');
$objCheck->setChecked($dependsContext);
$objTable->addRow(array($objLabel->show(), $objCheck->show()));
// Link Permissions
//$objHead->str = $linkPermLabel;
//$objHead->type = 3;
//$objTable->startRow();
//$objTable->addCell($objHead->show(), '', '','','','colspan="4"');
//$objTable->endRow();
//$objLink = new link('javascript:void(0)');
//$objLink->link = $setPermLabel;
//$objLink->extra = "onclick = \"javascript:window.open('". $this->uri(array('action'=>'setperm', 'modulename'=>$moduleName), '', '', TRUE)."', 'setperms', 'width=800, height=600, scrollbars')\"";
//$objTable->startRow();
//$objTable->addCell($objLink->show(), '', '','','','colspan="4"');
//$objTable->endRow();
$formElements = '';