Esempio n. 1
0
 $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>';
     echo '<p>' . $this->objLanguage->languageText('mod_filemanager_selectfolderattachfiles', 'filemanager', 'Please select the folder you would like these files to be placed in') . '</p>';
     echo $form->show();
 /**
  * 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;
 }
Esempio n. 3
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");
 $newLOTable->startRow();
 $newLOTable->addCell(Null);
 $newLOTable->addCell($loAddCount->show());
 $newLOTable->addCell(Null);
 $newLOTable->endRow();
Esempio n. 4
0
$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']);
        if ($this->isValid('removeuser')) {
            $string = str_replace('[-user-]', $guest['firstname'] . ' ' . $guest['surname'], $this->objLanguage->languageText('mod_contextgroups_confirmdeleteuser', 'contextgroups'));
            //ucwords($this->objLanguage->languageText('word_guest', 'system', 'guest'))
            $deleteicon = $objIcon->getDeleteIconWithConfirm(NULL, array('action' => 'removeuser', 'userid' => $guest['userid'], 'group' => 'Guest'), 'contextgroups', $string);
            $objTable->addCell($deleteicon);
Esempio n. 5
0
    $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) {
        $table->endRow();
    }
}
if ($counter % 2 == 1) {
    $table->addCell('&nbsp;');
    $table->addCell('&nbsp;');
    $table->addCell('&nbsp;');
    $table->endRow();
}
$form->addToForm($table->show());
         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());
 if ($counter > 0) {
     echo '<h1>' . $this->objLanguage->languageText('mod_filemanager_confirmdeletefiles', 'filemanager', 'Confirm Delete Files') . '?</h1>';
     echo '<p>' . $this->objLanguage->languageText('mod_filemanager_areyousuredeletefiles', 'filemanager', 'Are you sure you want to delete these files/folders?') . '</p>';
Esempio n. 7
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);
 }
 /**
  * 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();
 }
    /**
     * 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');
    }
Esempio n. 10
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();
     }
 }
Esempio n. 11
0
    $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'));
$button->cssId = 'savebutton';
$button->setToSubmit();
//$table_ = $table->show();
//if ($objSysConfig->getValue('context_access_private_only', 'context', 'false') == 'true') {
//    $table_ .= $access->show();
//}
$form->addToForm($table->show() . '<p><br />' . $button->show() . '</p>');
$hiddenInput = new hiddeninput('mode', $mode);
$form->addToForm($hiddenInput->show());
if ($mode == 'add') {
    $form->addRule('contextcode', $this->objLanguage->code2Txt('mod_contextadmin_pleaseentercontextcode', 'contextadmin', NULL, 'Please enter a [-context-] code'), 'required');
}
$form->addRule('title', $this->objLanguage->languageText('mod_contextadmin_pleaseentertitle', 'contextadmin', 'Please enter a title'), 'required');
 /**
  * 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();
     }
 }
Esempio n. 13
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;
 }
Esempio n. 14
0
$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();
}
$objInput = new textinput('moduleName', $moduleName);
Esempio n. 15
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/>';
 }
Esempio n. 16
0
 $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();
         } else {
             $checkBox = '';
         }
     } else {
         //registered
         if ($this->objModFile->findController($moduleId)) {
             $link = "<a href='{$this->uri(null, $moduleId)}'>{$moduleName}</a>";
         }
         $instButton =& new Link($this->uri(array('action' => 'uninstall', 'mod' => $moduleId, 'cat' => $activeCat, 'srchstr' => $srchStr, 'srchtype' => $srchType, 'lastaction' => $lastAction), 'modulecatalogue'));
         $instButton->link = $this->objLanguage->languageText('word_uninstall');
         $instButton->extra = "class=\"pseudobutton\"";
         $objConfirm =& $this->getObject('confirm', 'utilities');
         $objConfirm->setConfirm($this->objLanguage->languageText('word_uninstall'), $this->uri(array('action' => 'uninstall', 'mod' => $moduleId, 'cat' => $activeCat, 'srchstr' => $srchStr, 'srchtype' => $srchType, 'lastaction' => $lastAction), 'modulecatalogue'), str_replace('MODULE', $moduleId, $this->objLanguage->languageText('mod_modulecatalogue_deregsure', 'modulecatalogue')));
         $instButtonShow = $objConfirm->show();
         if ($batchuninstall) {