function pathConfiguration() { global $xoopsModule; // Upload and Images Folders smartmedia_collapsableBar('configtable', 'configtableicon'); echo "<img id='configtableicon' name='configtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SMEDIA_PATHCONFIGURATION . "</h3>"; echo "<div id='configtable'>"; echo "<br />"; echo "<table width='100%' class='outer' cellspacing='1' cellpadding='3' border='0' ><tr>"; echo "<td class='bg3'><b>" . _AM_SMEDIA_PATH_ITEM . "</b></td>"; echo "<td class='bg3'><b>" . _AM_SMEDIA_PATH . "</b></td>"; echo "<td class='bg3' align='center'><b>" . _AM_SMEDIA_STATUS . "</b></td></tr>"; echo "<tr><td class='odd'>" . _AM_SMEDIA_PATH_FILES . "</td>"; $upload_path = smartmedia_getUploadDir(); echo "<td class='odd'>" . $upload_path . "</td>"; echo "<td class='even' style='text-align: center;'>" . smartmedia_admin_getPathStatus('root') . "</td></tr>"; echo "<tr><td class='odd'>" . _AM_SMEDIA_PATH_IMAGES . "</td>"; $image_path = smartmedia_getImageDir(); echo "<td class='odd'>" . $image_path . "</td>"; echo "<td class='even' style='text-align: center;'>" . smartmedia_admin_getPathStatus('images') . "</td></tr>"; echo "<tr><td class='odd'>" . _AM_SMEDIA_PATH_IMAGES_CATEGORY . "</td>"; $image_path = smartmedia_getImageDir('category'); echo "<td class='odd'>" . $image_path . "</td>"; echo "<td class='even' style='text-align: center;'>" . smartmedia_admin_getPathStatus('images/category') . "</td></tr>"; echo "<tr><td class='odd'>" . _AM_SMEDIA_PATH_IMAGES_FOLDER . "</td>"; $image_path = smartmedia_getImageDir('folder'); echo "<td class='odd'>" . $image_path . "</td>"; echo "<td class='even' style='text-align: center;'>" . smartmedia_admin_getPathStatus('images/folder') . "</td></tr>"; echo "<tr><td class='odd'>" . _AM_SMEDIA_PATH_IMAGES_CLIP . "</td>"; $image_path = smartmedia_getImageDir('clip'); echo "<td class='odd'>" . $image_path . "</td>"; echo "<td class='even' style='text-align: center;'>" . smartmedia_admin_getPathStatus('images/clip') . "</td></tr>"; echo "</table>"; echo "<br />"; echo "</div>"; }
/** * Format the clip information into an array * * This method puts each usefull informations of the clip into an array that will be used in * the module template * * @param int $categoryid category to which belong the parent folder of the clip * @return array array containing usfull informations of the clip */ function toArray($categoryid, $max_title_length = 0, $forBlock = false) { $clip['clipid'] = $this->clipid(); $clip['itemurl'] = $this->getItemUrl($categoryid); $clip['itemlink'] = $this->getItemLink($categoryid, $max_title_length); if ($forBlock) { return $clip; } $clip['duration'] = $this->duration(); $clip['template'] = $this->renderTemplate(); $clip['width'] = $this->width(); $clip['height'] = $this->height(); $clip['weight'] = $this->weight(); $clip['counter'] = $this->counter(); $clip['statusid'] = $this->statusid(); $clip['autostart'] = $this->autostart(); $clip['counter'] = $this->counter(); if ($this->getVar('image_hr') != 'blank.png') { $clip['image_hr_path'] = smartmedia_getImageDir('clip', false) . $this->image_hr(); } else { $clip['image_hr_path'] = false; } $smartConfig =& smartmedia_getModuleConfig(); $clip['main_image_width'] = $smartConfig['main_image_width']; $clip['list_image_width'] = $smartConfig['list_image_width']; $clip['image_lr_path'] = smartmedia_getImageDir('clip', false) . $this->image_lr(); $clip['file_hr_path'] = $this->file_hr(); $clip['file_lr_path'] = $this->file_lr(); $clip['file_hr_link'] = "<a href='" . $this->file_hr() . "' target='_blank'>" . _MD_SMEDIA_HIGH_RES_CLIP . "</a>"; $clip['adminLinks'] = $this->adminLinks(); $clip['title'] = $this->title(); $clip['clean_title'] = $clip['title']; $clip['description'] = $this->description(); $clip['meta_description'] = $this->meta_description(); $clip['tab_caption_1'] = $this->tab_caption_1(); $clip['tab_text_1'] = $this->tab_text_1(); $clip['tab_caption_2'] = $this->tab_caption_2(); $clip['tab_text_2'] = $this->tab_text_2(); $clip['tab_caption_3'] = $this->tab_caption_3(); $clip['tab_text_3'] = $this->tab_text_3(); // Hightlighting searched words $highlight = true; if ($highlight && isset($_GET['keywords'])) { $myts =& MyTextSanitizer::getInstance(); $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords']))); $h = new keyhighlighter($keywords, true, 'smartmedia_highlighter'); $clip['title'] = $h->highlight($clip['title']); $clip['description'] = $h->highlight($clip['description']); $clip['tab_caption_1'] = $h->highlight($clip['tab_caption_1']); $clip['tab_text_1'] = $h->highlight($clip['tab_text_1']); $clip['tab_caption_2'] = $h->highlight($clip['tab_caption_2']); $clip['tab_text_2'] = $h->highlight($clip['tab_text_2']); $clip['tab_caption_3'] = $h->highlight($clip['tab_caption_3']); $clip['tab_text_3'] = $h->highlight($clip['tab_text_3']); } return $clip; }
function editfolder($showmenu = false, $folderid = 0, $categoryid = 0) { global $xoopsDB, $smartmedia_folder_handler, $xoopsUser, $myts, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // if $folderid == 0 then we are adding a new folder $newFolder = $folderid == 0; echo "<script type=\"text/javascript\" src=\"funcs.js\"></script>"; echo "<style>"; echo "<!-- "; echo "select { width: 130px; }"; echo "-->"; echo "</style>"; $cat_sel = ''; if (!$newFolder) { // We are editing a folder // Creating the folder object for the selected folder $folderObj = $smartmedia_folder_handler->get($folderid); $cat_sel = "&folderid=" . $folderObj->folderid(); $folderObj->loadLanguage($folderObj->default_languageid()); if ($showmenu) { smartmedia_adminMenu(2, _AM_SMEDIA_FOLDERS . " > " . _AM_SMEDIA_EDITING); } echo "<br />\n"; if ($folderObj->notLoaded()) { redirect_header("folder.php", 1, _AM_SMEDIA_NOFOLDERTOEDIT); exit; } smartmedia_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SMEDIA_FOLDER_EDIT . "</h3>"; echo "<div id='bottomtable'>"; echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">" . _AM_SMEDIA_FOLDER_EDIT_INFO . "</span>"; } else { // We are creating a new folder $folderObj = $smartmedia_folder_handler->create(); if ($showmenu) { smartmedia_adminMenu(2, _AM_SMEDIA_FOLDERS . " > " . _AM_SMEDIA_CREATINGNEW); } echo "<br />\n"; smartmedia_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SMEDIA_FOLDER_CREATE . "</h3>"; echo "<div id='bottomtable'>"; echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">" . _AM_SMEDIA_FOLDER_CREATE_INFO . "</span>"; } if (!$newFolder) { /* If it's not a new folder, lets display the already created folder language info for this folder, as well as a button to create a new folder language info */ if ($folderObj->canAddLanguage()) { // If not all languages have been added echo "<form><div style=\"margin-bottom: 0px;\">"; echo "<input type='button' name='button' onclick=\"location='folder.php?op=modtext&folderid=" . $folderObj->folderid() . "'\" value='" . _AM_SMEDIA_FOLDER_TEXT_CREATE . "'> "; echo "</div></form>"; echo "</div>"; } echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; echo "<tr>"; echo "<td width='20%' class='bg3' align='left'><b>" . _AM_SMEDIA_LANGUAGE . "</b></td>"; echo "<td class='bg3' align='left'><b>" . _AM_SMEDIA_FOLDER_TITLE . "</b></td>"; echo "<td width='60' class='bg3' align='center'><b>" . _AM_SMEDIA_ACTION . "</b></td>"; echo "</tr>"; $folder_textObjs = $folderObj->getAllLanguages(true); if (count($folder_textObjs) > 0) { foreach ($folder_textObjs as $key => $thiscat) { displayFolder_text($thiscat); } } else { echo "<tr>"; echo "<td class='head' align='center' colspan= '3'>" . _AM_SMEDIA_NO_LANGUAGE_INFO . "</td>"; echo "</tr>"; } echo "</table>\n<br/>"; } // Start folder form $sform = new XoopsThemeForm(_AM_SMEDIA_FOLDER, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormHidden('folderid', $folderid)); // Language $languageid_select = new XoopsFormSelectLang(_AM_SMEDIA_LANGUAGE_ITEM, 'default_languageid', $folderObj->default_languageid()); $languageid_select->setDescription(_AM_SMEDIA_LANGUAGE_ITEM_DSC); $languageid_select->addOptionArray(XoopsLists::getLangList()); if (!$newFolder) { $languageid_select->setExtra("style='color: grey;' disabled='disabled'"); } $sform->addElement($languageid_select); // title $sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_TITLE_REQ, 'title', 50, 255, $folderObj->title('e')), true); // short_title //$sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_SHORT_TITLE, 'short_title', 50, 255, $folderObj->short_title('e'))); $sform->addElement(new XoopsFormHidden('short_title', '')); // summary $summary = new XoopsFormTextArea(_AM_SMEDIA_FOLDER_SUMMARY, 'summary', $folderObj->summary('e'), 3, 60); $summary->setDescription(_AM_SMEDIA_FOLDER_SUMMARYDSC); $sform->addElement($summary); // Description $description_text = new XoopsFormTextArea(_AM_SMEDIA_FOLDER_DESCRIPTION, 'description', $folderObj->description('e'), 7, 60); $description_text->setDescription(_AM_SMEDIA_FOLDER_DESCRIPTIONDSC); $sform->addElement($description_text); // Meta-Description $meta = new XoopsFormTextArea(_AM_SMEDIA_FOLDER_META_DESCRIPTION, 'meta_description', $folderObj->meta_description('e'), 7, 60); $meta->setDescription(_AM_SMEDIA_CLIP_META_DESCRIPTIONDSC); $sform->addElement($meta); $sform->addElement(new XoopsFormHidden('itemType', 'item_text')); $category_tray = new XoopsFormElementTray(_AM_SMEDIA_CATEGORY); if (!$newFolder) { $category_action_select = new XoopsFormSelect('', 'category_action', 'change'); $category_action_select_array['change'] = _AM_SMEDIA_CATEGORY_CHANGE; $category_action_select_array['add'] = _AM_SMEDIA_CATEGORY_ADD; $category_action_select->addOptionArray($category_action_select_array); $category_tray->addElement($category_action_select); } else { $sform->addElement(new XoopsFormHidden('category_action', 'add')); } include_once SMARTMEDIA_ROOT_PATH . "class/smarttree.php"; $smarttree = new SmartTree($xoopsDB->prefix("smartmedia_categories"), "categoryid", "parentid"); ob_start(); $smarttree->makeMySelBox("title", "weight", $categoryid, 0, 'categoryid', ''); //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="") $category_tray->addElement(new XoopsFormLabel('', ob_get_contents())); ob_end_clean(); $sform->addElement($category_tray); // status $status_select = new XoopsFormSelect(_AM_SMEDIA_FOLDER_STATUS, 'statusid', $folderObj->statusid()); $status_select->addOptionArray(smartmedia_getStatusArray()); $sform->addElement($status_select); /* // LR IMAGE $lr_image_array = & XoopsLists :: getImgListAsArray( smartmedia_getImageDir('folder') ); $lr_image_select = new XoopsFormSelect( '', 'image_lr', $folderObj->image_lr() ); $lr_image_select -> addOption ('-1', '---------------'); $lr_image_select -> addOptionArray( $lr_image_array ); $lr_image_select -> setExtra( "onchange='showImgSelected(\"the_image_lr\", \"image_lr\", \"" . 'uploads/smartmedia/images/folder' . "\", \"\", \"" . XOOPS_URL . "\")'" ); $lr_image_tray = new XoopsFormElementTray( _AM_SMEDIA_FOLDER_IMAGE_LR, ' ' ); $lr_image_tray -> addElement( $lr_image_select ); $lr_image_tray -> addElement( new XoopsFormLabel( '', "<br /><br /><img src='" . smartmedia_getImageDir('folder', false) .$folderObj->image_lr() . "' name='the_image_lr' id='the_image_lr' alt='' />" ) ); $lr_image_tray->setDescription(_AM_SMEDIA_FOLDER_IMAGE_LR_DSC); $sform -> addElement( $lr_image_tray ); // LR IMAGE UPLOAD $max_size = 5000000; $lr_file_box = new XoopsFormFile(_AM_SMEDIA_FOLDER_IMAGE_LR_UPLOAD, "lr_image_file", $max_size); $lr_file_box->setExtra( "size ='45'") ; $lr_file_box->setDescription(_AM_SMEDIA_FOLDER_IMAGE_LR_UPLOAD_DSC); $sform->addElement($lr_file_box); */ // HR IMAGE $hr_image_array =& XoopsLists::getImgListAsArray(smartmedia_getImageDir('folder')); $hr_image_select = new XoopsFormSelect('', 'image_hr', $folderObj->image_hr()); $hr_image_select->addOption('-1', '---------------'); $hr_image_select->addOptionArray($hr_image_array); $hr_image_select->setExtra("onchange='showImgSelected(\"the_image_hr\", \"image_hr\", \"" . 'uploads/smartmedia/images/folder' . "\", \"\", \"" . XOOPS_URL . "\")'"); $hr_image_tray = new XoopsFormElementTray(_AM_SMEDIA_FOLDER_IMAGE_HR, ' '); $hr_image_tray->addElement($hr_image_select); $hr_image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartmedia_getImageDir('folder', false) . $folderObj->image_hr() . "' name='the_image_hr' id='the_image_hr' alt='' />")); $hr_image_tray->setDescription(sprintf(_AM_SMEDIA_FOLDER_IMAGE_HR_DSC, $xoopsModuleConfig['main_image_width'])); $sform->addElement($hr_image_tray); // HR IMAGE UPLOAD $max_size = 5000000; $hr_file_box = new XoopsFormFile(_AM_SMEDIA_FOLDER_IMAGE_HR_UPLOAD, "hr_image_file", $max_size); $hr_file_box->setExtra("size ='45'"); $hr_file_box->setDescription(_AM_SMEDIA_FOLDER_IMAGE_HR_UPLOAD_DSC); $sform->addElement($hr_file_box); // Weight $sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_WEIGHT, 'weight', 4, 4, $folderObj->weight())); $sform->addElement(new XoopsFormHidden('itemType', 'item')); // Action buttons tray $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'addfolder'); $button_tray->addElement($hidden); if ($newFolder) { // We are creating a new folder $butt_create = new XoopsFormButton('', '', _AM_SMEDIA_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfolder\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SMEDIA_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SMEDIA_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } else { // We are editing a folder $butt_create = new XoopsFormButton('', '', _AM_SMEDIA_MODIFY, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfolder\'"'); $button_tray->addElement($butt_create); $butt_cancel = new XoopsFormButton('', '', _AM_SMEDIA_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } $sform->addElement($button_tray); $sform->display(); echo "</div>"; unset($hidden); }
/** * Format the folder information into an array * * This method puts each usefull informations of the folder into an array that will be used * in the modules template * * @return array array containing usfull informations of the folder */ function toArray() { $folder['folderid'] = $this->folderid(); $folder['categoryid'] = $this->categoryid(); $folder['itemurl'] = $this->getItemUrl(); $folder['itemlink'] = $this->getItemLink(); $folder['weight'] = $this->weight(); if ($this->getVar('image_hr') != 'blank.png') { $folder['image_hr_path'] = smartmedia_getImageDir('folder', false) . $this->image_hr(); } else { $folder['image_hr_path'] = false; } $smartConfig =& smartmedia_getModuleConfig(); $folder['main_image_width'] = $smartConfig['main_image_width']; $folder['list_image_width'] = $smartConfig['list_image_width']; $folder['image_lr_path'] = smartmedia_getImageDir('folder', false) . $this->image_lr(); $folder['counter'] = $this->counter(); $folder['adminLinks'] = $this->adminLinks(); $folder['title'] = $this->title(); $folder['clean_title'] = $folder['title']; $folder['short_title'] = $this->title(); $folder['summary'] = $this->summary(); $folder['description'] = $this->description(); $folder['meta_description'] = $this->meta_description(); // Hightlighting searched words $highlight = true; if ($highlight && isset($_GET['keywords'])) { $myts =& MyTextSanitizer::getInstance(); $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords']))); $h = new keyhighlighter($keywords, true, 'smartmedia_highlighter'); $folder['title'] = $h->highlight($folder['title']); $folder['summary'] = $h->highlight($folder['summary']); $folder['description'] = $h->highlight($folder['description']); } return $folder; }