예제 #1
0
 /**
  * Get a {@link XoopsForm} object for creating/editing Spotlight articles
  *
  * @return object
  */
 function getForm($action = false)
 {
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = _AMS_AM_SPOTLIGHT;
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/formimageselect.php";
     $form = new XoopsThemeForm($title, 'spotlightform', $action);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormHidden('id', $this->getVar('spotlightid')));
     }
     $mode_select = new XoopsFormRadio('', 'mode', $this->getVar('mode'));
     $mode_select->addOption(1, _AMS_AM_SPOT_LATESTARTICLE);
     $mode_select->addOption(2, _AMS_AM_SPOT_LATESTINTOPIC);
     $mode_select->addOption(3, _AMS_AM_SPOT_SPECIFICARTICLE);
     $mode_select->addOption(4, _AMS_AM_SPOT_CUSTOM);
     include_once XOOPS_ROOT_PATH . "/class/tree.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newstopic.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
     $xt = new AmsTopic($GLOBALS['xoopsDB']->prefix("ams_topics"));
     $allTopics = $xt->getAllTopics();
     $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
     $topic_select = new XoopsFormLabel(_AMS_AM_TOPIC, $topic_obj_tree->makeSelBox('topicid', 'topic_title', '--', $this->getVar('topicid'), false));
     $topic_select->setDescription(_AMS_AM_SPOT_TOPIC_DESC);
     $article_select = new XoopsFormSelect(_AMS_AM_ARTICLE, 'storyid', $this->getVar('storyid'));
     $article_select->addOptionArray(AmsStory::getAllPublished($GLOBALS['xoopsModuleConfig']['spotlight_art_num'], 0, false, 0, 1, false));
     $article_select->setDescription(_AMS_AM_SPOT_ARTICLE_DESC);
     $mode_tray = new XoopsFormElementTray(_AMS_AM_SPOT_MODE_SELECT);
     $mode_tray->addElement($mode_select);
     $showimage_select = new XoopsFormRadio(_AMS_AM_SPOT_SHOWIMAGE, 'showimage', $this->getVar('showimage'));
     $showimage_select->addOption(0, _AMS_AM_SPOT_SPECIFYIMAGE);
     $showimage_select->addOption(1, _AMS_AM_SPOT_TOPICIMAGE);
     $showimage_select->addOption(2, _AMS_AM_SPOT_AUTHORIMAGE);
     $showimage_select->addOption(3, _AMS_AM_SPOT_NOIMAGE);
     $showimage_select->setDescription(_AMS_AM_SPOT_SHOWIMAGE_DESC);
     $image_select = new XoopsFormImageSelect(_AMS_AM_SPOT_IMAGE, 'image', $this->getVar('image', 'e'), 70, 255);
     $autoteaser_select = new XoopsFormRadioYN(_AMS_AM_SPOT_AUTOTEASER, 'autoteaser', $this->getVar('autoteaser'));
     $teaser_text = new XoopsFormDhtmlTextArea(_AMS_AM_SPOT_TEASER, 'teaser', $this->getVar('teaser', 'e'));
     $maxlength_text = new XoopsFormText(_AMS_AM_SPOT_MAXLENGTH, 'maxlength', 10, 10, $this->getVar('maxlength'));
     $display_select = new XoopsFormRadioYN(_AMS_AM_SPOT_DISPLAY, 'display', $this->getVar('display'));
     $weight_text = new XoopsFormText(_AMS_AM_SPOT_WEIGHT, 'weight', 10, 10, $this->getVar('weight'));
     $form->addElement($mode_tray);
     $form->addElement($topic_select);
     $form->addElement($article_select);
     $form->addElement($showimage_select);
     $form->addElement($image_select);
     $form->addElement($autoteaser_select);
     $form->addElement($maxlength_text);
     $form->addElement($teaser_text);
     $form->addElement($display_select);
     $form->addElement($weight_text);
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButton('', 'spotlightsubmit', _AMS_AM_SUBMIT, 'submit'));
     return $form;
 }
예제 #2
0
function import_spiders_form()
{
    include XOOPS_ROOT_PATH . '/class/xoopslists.php';
    $xl = new XoopsLists();
    $files = $xl->getFileListAsArray(XOOPS_ROOT_PATH . '/modules/' . _MI_SPIDERS_DIRNAME . '/admin/resources/');
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    $form = new XoopsThemeForm(_AM_SPIDERS_IMPORTFILE, "import", "", "post");
    $fileelement = new XoopsFormSelect(_AM_SPIDERS_FILE, 'file', $file);
    $fileelement->setDescription(_AM_SPIDERS_FILEDESC);
    foreach ($files as $key => $file) {
        if (strpos($file, '.txt') > 0) {
            $options[$key] = $file;
        }
    }
    $fileelement->addOptionArray($options);
    $form->addElement($fileelement);
    $form->addElement(new XoopsFormHidden("op", 'import-file'));
    $form->addElement(new XoopsFormButton('', 'contents_submit', _SUBMIT, "submit"));
    $form->display();
}
예제 #3
0
    /**
     * @param $obj
     *
     * @return $this
     */
    public function createElements($obj)
    {
        $publisher =& PublisherPublisher::getInstance();
        $allowedEditors = publisherGetEditors($publisher->getHandler('permission')->getGrantedItems('editors'));
        if (!is_object($GLOBALS['xoopsUser'])) {
            $group = array(XOOPS_GROUP_ANONYMOUS);
        } else {
            $group = $GLOBALS['xoopsUser']->getGroups();
        }
        $this->setExtra('enctype="multipart/form-data"');
        $this->startTab(_CO_PUBLISHER_TAB_MAIN);
        // Category
        $categoryFormSelect = new XoopsFormSelect(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e'));
        $categoryFormSelect->setDescription(_CO_PUBLISHER_CATEGORY_DSC);
        $categoryFormSelect->addOptionArray($publisher->getHandler('category')->getCategoriesForSubmit());
        $this->addElement($categoryFormSelect);
        // ITEM TITLE
        $this->addElement(new XoopsFormText(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true);
        // SUBTITLE
        if ($this->isGranted(PublisherConstants::PUBLISHER_SUBTITLE)) {
            $this->addElement(new XoopsFormText(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e')));
        }
        // SHORT URL
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_SHORT_URL)) {
            $textShortUrl = new XoopsFormText(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->short_url('e'));
            $textShortUrl->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC);
            $this->addElement($textShortUrl);
        }
        // TAGS
        if (xoops_isActiveModule('tag') && $this->isGranted(PublisherConstants::PUBLISHER_ITEM_TAG)) {
            include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
            $textTags = new XoopsFormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
            $this->addElement($textTags);
        }
        // SELECT EDITOR
        $nohtml = !$obj->dohtml();
        if (count($allowedEditors) === 1) {
            $editor = $allowedEditors[0];
        } elseif (count($allowedEditors) > 0) {
            $editor = XoopsRequest::getString('editor', '', 'POST');
            if (!empty($editor)) {
                publisherSetCookieVar('publisher_editor', $editor);
            } else {
                $editor = publisherGetCookieVar('publisher_editor');
                if (empty($editor) && is_object($GLOBALS['xoopsUser'])) {
                    //                    $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile
                    $editor = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : '';
                    // Need set through user profile
                }
            }
            $editor = empty($editor) || !in_array($editor, $allowedEditors) ? $publisher->getConfig('submit_editor') : $editor;
            $formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
            $this->addElement($formEditor);
        } else {
            $editor = $publisher->getConfig('submit_editor');
        }
        $editorConfigs = array();
        $editorConfigs['rows'] = !$publisher->getConfig('submit_editor_rows') ? 35 : $publisher->getConfig('submit_editor_rows');
        $editorConfigs['cols'] = !$publisher->getConfig('submit_editor_cols') ? 60 : $publisher->getConfig('submit_editor_cols');
        $editorConfigs['width'] = !$publisher->getConfig('submit_editor_width') ? '100%' : $publisher->getConfig('submit_editor_width');
        $editorConfigs['height'] = !$publisher->getConfig('submit_editor_height') ? '400px' : $publisher->getConfig('submit_editor_height');
        // SUMMARY
        if ($this->isGranted(PublisherConstants::PUBLISHER_SUMMARY)) {
            // Description
            //$summaryText = new XoopsFormTextArea(_CO_PUBLISHER_SUMMARY, 'summary', $obj->getVar('summary', 'e'), 7, 60);
            $editorConfigs['name'] = 'summary';
            $editorConfigs['value'] = $obj->getVar('summary', 'e');
            $summaryText = new XoopsFormEditor(_CO_PUBLISHER_SUMMARY, $editor, $editorConfigs, $nohtml, $onfailure = null);
            $summaryText->setDescription(_CO_PUBLISHER_SUMMARY_DSC);
            $this->addElement($summaryText);
        }
        // BODY
        $editorConfigs['name'] = 'body';
        $editorConfigs['value'] = $obj->getVar('body', 'e');
        $bodyText = new XoopsFormEditor(_CO_PUBLISHER_BODY, $editor, $editorConfigs, $nohtml, $onfailure = null);
        $bodyText->setDescription(_CO_PUBLISHER_BODY_DSC);
        $this->addElement($bodyText);
        // VARIOUS OPTIONS
        if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML) || $this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY) || $this->isGranted(PublisherConstants::PUBLISHER_DOXCODE) || $this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE) || $this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML)) {
                $html_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO);
                $this->addElement($html_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY)) {
                $smiley_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO);
                $this->addElement($smiley_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOXCODE)) {
                $xcode_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->doxcode(), _YES, _NO);
                $this->addElement($xcode_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE)) {
                $image_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->doimage(), _YES, _NO);
                $this->addElement($image_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
                $linebreak_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->dobr(), _YES, _NO);
                $this->addElement($linebreak_radio);
            }
        }
        // Available pages to wrap
        if ($this->isGranted(PublisherConstants::PUBLISHER_AVAILABLE_PAGE_WRAP)) {
            $wrapPages = XoopsLists::getHtmlListAsArray(publisherGetUploadDir(true, 'content'));
            $availableWrapPagesText = array();
            foreach ($wrapPages as $page) {
                $availableWrapPagesText[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
            }
            $availableWrapPages = new XoopsFormLabel(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $availableWrapPagesText));
            $availableWrapPages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC);
            $this->addElement($availableWrapPages);
        }
        // Uid
        /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
            the method users::getobjects encounters a memory error
            */
        // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL
        if ($this->isGranted(PublisherConstants::PUBLISHER_UID)) {
            $uidSelect = new XoopsFormSelect(_CO_PUBLISHER_UID, 'uid', $obj->uid(), 1, false);
            $uidSelect->setDescription(_CO_PUBLISHER_UID_DSC);
            $sql = 'SELECT uid, uname FROM ' . $obj->db->prefix('users') . ' ORDER BY uname ASC';
            $result = $obj->db->query($sql);
            $usersArray = array();
            $usersArray[0] = $GLOBALS['xoopsConfig']['anonymous'];
            while (($myrow = $obj->db->fetchArray($result)) !== false) {
                $usersArray[$myrow['uid']] = $myrow['uname'];
            }
            $uidSelect->addOptionArray($usersArray);
            $this->addElement($uidSelect);
        }
        /* else {
           $hidden = new XoopsFormHidden('uid', $obj->uid());
           $this->addElement($hidden);
           unset($hidden);
           }*/
        // Author ALias
        if ($this->isGranted(PublisherConstants::PUBLISHER_AUTHOR_ALIAS)) {
            $element = new XoopsFormText(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e'));
            $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC);
            $this->addElement($element);
            unset($element);
        }
        // STATUS
        if ($this->isGranted(PublisherConstants::PUBLISHER_STATUS)) {
            $options = array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, PublisherConstants::PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, PublisherConstants::PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, PublisherConstants::PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED);
            $statusSelect = new XoopsFormSelect(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status'));
            $statusSelect->addOptionArray($options);
            $statusSelect->setDescription(_CO_PUBLISHER_STATUS_DSC);
            $this->addElement($statusSelect);
            unset($statusSelect);
        }
        // Datesub
        if ($this->isGranted(PublisherConstants::PUBLISHER_DATESUB)) {
            if ($obj->isNew()) {
                $datesub = time();
            } else {
                $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub');
            }
            $datesub_datetime = new PublisherFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true);
            // $datesub_datetime = new XoopsFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true);
            $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC);
            $this->addElement($datesub_datetime);
        }
        // NOTIFY ON PUBLISH
        if ($this->isGranted(PublisherConstants::PUBLISHER_NOTIFY)) {
            $notify_radio = new XoopsFormRadioYN(_CO_PUBLISHER_NOTIFY, 'notify', $obj->notifypub(), _YES, _NO);
            $this->addElement($notify_radio);
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_IMAGES)) {
            $this->startTab(_CO_PUBLISHER_TAB_IMAGES);
        }
        // IMAGE
        if ($this->isGranted(PublisherConstants::PUBLISHER_IMAGE_ITEM)) {
            $objimages = $obj->getImages();
            $mainarray = is_object($objimages['main']) ? array($objimages['main']) : array();
            $mergedimages = array_merge($mainarray, $objimages['others']);
            $objimage_array = array();
            foreach ($mergedimages as $imageObj) {
                $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
            }
            $imgcatHandler =& xoops_getHandler('imagecategory');
            if (method_exists($imgcatHandler, 'getListByPermission')) {
                $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1);
            } else {
                $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
            }
            $catids = array_keys($catlist);
            $imageObjs = array();
            if (!empty($catids)) {
                $imageHandler =& xoops_getHandler('image');
                $criteria = new CriteriaCompo(new Criteria('imgcat_id', '(' . implode(',', $catids) . ')', 'IN'));
                $criteria->add(new Criteria('image_display', 1));
                $criteria->setSort('image_nicename');
                $criteria->setOrder('ASC');
                $imageObjs = $imageHandler->getObjects($criteria, true);
                unset($criteria);
            }
            $image_array = array();
            foreach ($imageObjs as $imageObj) {
                $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
            }
            $image_array = array_diff($image_array, $objimage_array);
            $imageSelect = new XoopsFormSelect('', 'image_notused', '', 5);
            $imageSelect->addOptionArray($image_array);
            $imageSelect->setExtra("onchange='showImgSelected(\"image_display\", \"image_notused\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            //$imageSelect->setExtra( "onchange='appendMySelectOption(\"image_notused\", \"image_item\")'");
            unset($image_array);
            $imageSelect2 = new XoopsFormSelect('', 'image_item', '', 5, true);
            $imageSelect2->addOptionArray($objimage_array);
            $imageSelect2->setExtra("onchange='publisher_updateSelectOption(\"image_item\", \"image_featured\"), showImgSelected(\"image_display\", \"image_item\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            $buttonadd = new XoopsFormButton('', 'buttonadd', _CO_PUBLISHER_ADD);
            $buttonadd->setExtra("onclick='publisher_appendSelectOption(\"image_notused\", \"image_item\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
            $buttonremove = new XoopsFormButton('', 'buttonremove', _CO_PUBLISHER_REMOVE);
            $buttonremove->setExtra("onclick='publisher_appendSelectOption(\"image_item\", \"image_notused\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
            $opentable = new XoopsFormLabel('', '<table><tr><td>');
            $addcol = new XoopsFormLabel('', '</td><td>');
            $addbreak = new XoopsFormLabel('', '<br />');
            $closetable = new XoopsFormLabel('', '</td></tr></table>');
            $GLOBALS['xoTheme']->addScript(PUBLISHER_URL . '/assets/js/ajaxupload.3.9.js');
            $js_data = new XoopsFormLabel('', '
<script type= "text/javascript">/*<![CDATA[*/
$publisher(document).ready(function () {
    var button = $publisher("#publisher_upload_button"), interval;
    new AjaxUpload(button,{
        action: "' . PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons
        responseType: "text/html",
        name: "publisher_upload_file",
        onSubmit : function (file, ext) {
            // change button text, when user selects file
            $publisher("#publisher_upload_message").html(" ");
            button.html("<img src=\'' . PUBLISHER_URL . '/assets/images/loadingbar.gif\'/>"); this.setData({
                "image_nicename": $publisher("#image_nicename").val(),
                "imgcat_id" : $publisher("#imgcat_id").val()
            });
            // If you want to allow uploading only 1 file at time,
            // you can disable upload button
            this.disable();
            interval = window.setInterval(function () {
            }, 200);
        },
        onComplete: function (file, response) {
            button.text("' . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '");
            window.clearInterval(interval);
            // enable upload button
            this.enable();
            // add file to the list
            var result = eval(response);
            if ("success" == result[0]) {
                 $publisher("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>");
                 publisher_updateSelectOption(\'image_item\', \'image_featured\');
                 showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . XOOPS_URL . '\')
            } else {
                 $publisher("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>");
            }
        }
    });
});
/*]]>*/</script>
');
            $messages = new XoopsFormLabel('', "<div id='publisher_upload_message'></div>");
            $button = new XoopsFormLabel('', "<div id='publisher_upload_button'>" . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '</div>');
            $nicename = new XoopsFormText('', 'image_nicename', 30, 30, _CO_PUBLISHER_IMAGE_NICENAME);
            $imgcatHandler =& xoops_getHandler('imagecategory');
            if (method_exists($imgcatHandler, 'getListByPermission')) {
                $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1);
            } else {
                $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
            }
            $imagecat = new XoopsFormSelect('', 'imgcat_id', '', 1);
            $imagecat->addOptionArray($catlist);
            $imageUploadTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_UPLOAD, '');
            $imageUploadTray->addElement($js_data);
            $imageUploadTray->addElement($messages);
            $imageUploadTray->addElement($opentable);
            $imageUploadTray->addElement($imagecat);
            $imageUploadTray->addElement($addbreak);
            $imageUploadTray->addElement($nicename);
            $imageUploadTray->addElement($addbreak);
            $imageUploadTray->addElement($button);
            $imageUploadTray->addElement($closetable);
            $this->addElement($imageUploadTray);
            $imageTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_ITEMS, '');
            $imageTray->addElement($opentable);
            $imageTray->addElement($imageSelect);
            $imageTray->addElement($addbreak);
            $imageTray->addElement($buttonadd);
            $imageTray->addElement($addcol);
            $imageTray->addElement($imageSelect2);
            $imageTray->addElement($addbreak);
            $imageTray->addElement($buttonremove);
            $imageTray->addElement($closetable);
            $imageTray->setDescription(_CO_PUBLISHER_IMAGE_ITEMS_DSC);
            $this->addElement($imageTray);
            $imagename = is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : '';
            $imageforpath = $imagename != '' ? $imagename : 'blank.gif';
            $imageSelect3 = new XoopsFormSelect(_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1);
            $imageSelect3->addOptionArray($objimage_array);
            $imageSelect3->setExtra("onchange='showImgSelected(\"image_display\", \"image_featured\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            $imageSelect3->setDescription(_CO_PUBLISHER_IMAGE_ITEM_DSC);
            $this->addElement($imageSelect3);
            $image_preview = new XoopsFormLabel(_CO_PUBLISHER_IMAGE_PREVIEW, "<img src='" . XOOPS_URL . '/uploads/' . $imageforpath . "' name='image_display' id='image_display' alt='' />");
            $this->addElement($image_preview);
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_FILES)) {
            $this->startTab(_CO_PUBLISHER_TAB_FILES);
        }
        // File upload UPLOAD
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_UPLOAD_FILE)) {
            // NAME
            $nameText = new XoopsFormText(_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, '');
            $nameText->setDescription(_CO_PUBLISHER_FILE_NAME_DSC);
            $this->addElement($nameText);
            unset($nameText);
            // DESCRIPTION
            $descriptionText = new XoopsFormTextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', '');
            $descriptionText->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC);
            $this->addElement($descriptionText);
            unset($descriptionText);
            $statusSelect = new XoopsFormRadioYN(_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1);
            //1 - active
            $statusSelect->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC);
            $this->addElement($statusSelect);
            unset($statusSelect);
            $fileBox = new XoopsFormFile(_CO_PUBLISHER_ITEM_UPLOAD_FILE, 'item_upload_file', 0);
            $fileBox->setDescription(_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC);
            $fileBox->setExtra("size ='50'");
            $this->addElement($fileBox);
            unset($fileBox);
            if (!$obj->isNew()) {
                $filesObj =& $publisher->getHandler('file')->getAllFiles($obj->itemid());
                if (count($filesObj) > 0) {
                    $table = '';
                    $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
                    $table .= '<tr>';
                    $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>";
                    $table .= "<td width='150' class='bg3' align='left'><strong>" . _AM_PUBLISHER_FILENAME . '</strong></td>';
                    $table .= "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_DESCRIPTION . '</strong></td>';
                    $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . '</strong></td>';
                    $table .= "<td width='100' class='bg3' align='center'><strong>" . _AM_PUBLISHER_UPLOADED_DATE . '</strong></td>';
                    $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>';
                    $table .= '</tr>';
                    foreach ($filesObj as $fileObj) {
                        $modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "' /></a>";
                        $delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'/></a>";
                        if ($fileObj->status() == 0) {
                            $not_visible = "<img src='" . PUBLISHER_URL . "/assets/images/no.gif'/>";
                        } else {
                            $not_visible = '';
                        }
                        $table .= '<tr>';
                        $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . '</td>';
                        $table .= "<td class='odd' align='left'>" . $not_visible . $fileObj->getFileLink() . '</td>';
                        $table .= "<td class='even' align='left'>" . $fileObj->description() . '</td>';
                        $table .= "<td class='even' align='center'>" . $fileObj->counter() . '';
                        $table .= "<td class='even' align='center'>" . $fileObj->getDatesub() . '</td>';
                        $table .= "<td class='even' align='center'> {$modify} {$delete} </td>";
                        $table .= '</tr>';
                    }
                    $table .= '</table>';
                    $files_box = new XoopsFormLabel(_CO_PUBLISHER_FILES_LINKED, $table);
                    $this->addElement($files_box);
                    unset($files_box, $filesObj, $fileObj);
                }
            }
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_OTHERS)) {
            $this->startTab(_CO_PUBLISHER_TAB_OTHERS);
        }
        //$this->startTab(_CO_PUBLISHER_TAB_META);
        // Meta Keywords
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_KEYWORDS)) {
            $text_meta_keywords = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->meta_keywords('e'), 7, 60);
            $text_meta_keywords->setDescription(_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC);
            $this->addElement($text_meta_keywords);
        }
        // Meta Description
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_DESCRIPTION)) {
            $text_meta_description = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->meta_description('e'), 7, 60);
            $text_meta_description->setDescription(_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC);
            $this->addElement($text_meta_description);
        }
        //$this->startTab(_CO_PUBLISHER_TAB_PERMISSIONS);
        // COMMENTS
        if ($this->isGranted(PublisherConstants::PUBLISHER_ALLOWCOMMENTS)) {
            $addcomments_radio = new XoopsFormRadioYN(_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->cancomment(), _YES, _NO);
            $this->addElement($addcomments_radio);
        }
        // WEIGHT
        if ($this->isGranted(PublisherConstants::PUBLISHER_WEIGHT)) {
            $this->addElement(new XoopsFormText(_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->weight()));
        }
        $this->endTabs();
        //COMMON TO ALL TABS
        $button_tray = new XoopsFormElementTray('', '');
        if (!$obj->isNew()) {
            $button_tray->addElement(new XoopsFormButton('', 'additem', _SUBMIT, 'submit'));
            //orclone
        } else {
            $button_tray->addElement(new XoopsFormButton('', 'additem', _CO_PUBLISHER_CREATE, 'submit'));
            $button_tray->addElement(new XoopsFormButton('', '', _CO_PUBLISHER_CLEAR, 'reset'));
        }
        $button_tray->addElement(new XoopsFormButton('', 'preview', _CO_PUBLISHER_PREVIEW, 'submit'));
        $butt_cancel = new XoopsFormButton('', '', _CO_PUBLISHER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $this->addElement($button_tray);
        $hidden = new XoopsFormHidden('itemid', $obj->itemid());
        $this->addElement($hidden);
        unset($hidden);
        return $this;
    }
예제 #4
0
파일: products.php 프로젝트: naao/myshop
 $criteria = new Criteria('product_id', $item->getVar('product_id'), '<>');
 $criteria->setSort('product_title');
 $relatedProducts = $h_myshop_products->getObjects($criteria);
 foreach ($relatedProducts as $oneitem) {
     $relatedProducts_d[$oneitem->getVar('product_id')] = xoops_trim($oneitem->getVar('product_title'));
 }
 if ($edit) {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('related_product_id', $item->getVar('product_id'), '='));
     $productRelated = $h_myshop_related->getObjects($criteria);
     foreach ($productRelated as $oneproduct) {
         $productRelated_d[] = $oneproduct->getVar('related_product_related');
     }
 }
 $related_select = new XoopsFormSelect(_MYSHOP_RELATED_PRODUCTS, 'relatedproducts', $productRelated_d, 5, true);
 $related_select->setDescription(_AM_MYSHOP_RELATED_HELP . '<br />' . _AM_MYSHOP_SELECT_HLP);
 $related_select->addOptionArray($relatedProducts_d);
 $sform->addElement($related_select, false);
 if (myshop_utils::getModuleOption('use_price')) {
     // VAT
     $vatSelect = new XoopsFormSelect(_MYSHOP_VAT, 'product_vat_id', $item->getVar('product_vat_id'));
     $vatSelect->addOptionArray($vatsForDisplay);
     $sform->addElement($vatSelect, true);
     $sform->addElement(new XoopsFormText(_MYSHOP_PRICE, 'product_price', 20, 20, $item->getVar('product_price', 'e')), true);
     $sform->addElement(new XoopsFormText(_AM_MYSHOP_DISCOUNT_HLP, 'product_discount_price', 20, 20, $item->getVar('product_discount_price', 'e')), false);
     $sform->addElement(new XoopsFormText(_MYSHOP_SHIPPING_PRICE, 'product_shipping_price', 20, 20, $item->getVar('product_shipping_price', 'e')), false);
     $sform->addElement(new XoopsFormText(_MYSHOP_ECOTAXE, 'product_ecotaxe', 10, 10, $item->getVar('product_ecotaxe', 'e')), false);
 }
 $sform->addElement(new XoopsFormText(_MYSHOP_STOCK_QUANTITY, 'product_stock', 10, 10, $item->getVar('product_stock', 'e')), false);
 $alertStock = new XoopsFormText(_MYSHOP_STOCK_ALERT, 'product_alert_stock', 10, 10, $item->getVar('product_alert_stock', 'e'));
 $alertStock->setDescription(_AM_MYSHOP_STOCK_HLP);
예제 #5
0
function editclient($showmenu = false, $id = 0)
{
    global $client_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a client
    if ($id != 0) {
        // Creating the client object
        $clientObj = new SmartclientClient($id);
        if ($clientObj->notLoaded()) {
            redirect_header("client.php", 1, _AM_SCLIENT_NOCLIENTSELECTED);
            exit;
        }
        switch ($clientObj->status()) {
            case _SCLIENT_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SCLIENT_SUBMITTED_CLIENTS;
                $breadcrumb_action2 = _AM_SCLIENT_APPROVING;
                $page_title = _AM_SCLIENT_SUBMITTED_TITLE;
                $page_info = _AM_SCLIENT_SUBMITTED_INFO;
                $button_caption = _AM_SCLIENT_APPROVE;
                $new_status = _SCLIENT_STATUS_ACTIVE;
                break;
            case _SCLIENT_STATUS_ACTIVE:
                $breadcrumb_action1 = _AM_SCLIENT_ACTIVE_CLIENTS;
                $breadcrumb_action2 = _AM_SCLIENT_EDITING;
                $page_title = _AM_SCLIENT_ACTIVE_EDITING;
                $page_info = _AM_SCLIENT_ACTIVE_EDITING_INFO;
                $button_caption = _AM_SCLIENT_MODIFY;
                $new_status = _SCLIENT_STATUS_ACTIVE;
                break;
            case _SCLIENT_STATUS_INACTIVE:
                $breadcrumb_action1 = _AM_SCLIENT_INACTIVE_CLIENTS;
                $breadcrumb_action2 = _AM_SCLIENT_EDITING;
                $page_title = _AM_SCLIENT_INACTIVE_EDITING;
                $page_info = _AM_SCLIENT_INACTIVE_EDITING_INFO;
                $button_caption = _AM_SCLIENT_MODIFY;
                $new_status = _SCLIENT_STATUS_INACTIVE;
                break;
            case _SCLIENT_STATUS_REJECTED:
                $breadcrumb_action1 = _AM_SCLIENT_REJECTED_CLIENTS;
                $breadcrumb_action2 = _AM_SCLIENT_EDITING;
                $page_title = _AM_SCLIENT_REJECTED_EDITING;
                $page_info = _AM_SCLIENT_REJECTED_EDITING_INFO;
                $button_caption = _AM_SCLIENT_MODIFY;
                $new_status = _SCLIENT_STATUS_REJECTED;
                break;
            case "default":
            default:
                break;
        }
        if ($showmenu) {
            smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        smartclient_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . $page_title . "</h3>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $page_info . "</span>";
        echo "<div id='bottomtable'>";
    } else {
        // there's no parameter, so we're adding a client
        $clientObj =& $client_handler->create();
        $breadcrumb_action1 = _AM_SCLIENT_CLIENTS;
        $breadcrumb_action2 = _AM_SCLIENT_CREATE;
        $button_caption = _AM_SCLIENT_CREATE;
        $new_status = _SCLIENT_STATUS_ACTIVE;
        if ($showmenu) {
            smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        smartclient_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SCLIENT_CLIENT_CREATING . "</h3>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SCLIENT_CLIENT_CREATING_DSC . "</span>";
        echo "<div id='bottomtable'>";
    }
    // CLIENT FORM
    $sform = new XoopsThemeForm(_AM_SCLIENT_CLIENTS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // TITLE
    $title_text = new XoopsFormText(_CO_SCLIENT_TITLE_REQ, 'title', 50, 255, $clientObj->title('e'));
    $sform->addElement($title_text, true);
    // LOGO
    $logo_array =& XoopsLists::getImgListAsArray(smartclient_getImageDir());
    $logo_select = new XoopsFormSelect('', 'image', $clientObj->image());
    $logo_select->addOption('-1', '---------------');
    $logo_select->addOptionArray($logo_array);
    $logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTCLIENT_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $logo_tray = new XoopsFormElementTray(_AM_SCLIENT_LOGO, '&nbsp;');
    $logo_tray->addElement($logo_select);
    $logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartclient_getImageDir('', false) . $clientObj->image() . "' name='image3' id='image3' alt='' />"));
    $logo_tray->setDescription(_AM_SCLIENT_LOGO_DSC);
    $sform->addElement($logo_tray);
    // LOGO UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SCLIENT_LOGO_UPLOAD, "logo_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(sprintf(_AM_SCLIENT_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height']));
    $sform->addElement($file_box);
    // IMAGE_URL
    $image_url_text = new XoopsFormText(_CO_SCLIENT_IMAGE_URL, 'image_url', 50, 255, $clientObj->image_url());
    $image_url_text->setDescription(_CO_SCLIENT_IMAGE_URL_DSC);
    $sform->addElement($image_url_text, false);
    // URL
    $url_text = new XoopsFormText(_AM_SCLIENT_URL, 'url', 50, 255, $clientObj->url());
    $url_text->setDescription(_AM_SCLIENT_URL_DSC);
    $sform->addElement($url_text, false);
    // SUMMARY
    $summary_text = new XoopsFormTextArea(_AM_SCLIENT_SUMMARY_REQ, 'summary', $clientObj->summary(0, 'e'), 7, 60);
    $summary_text->setDescription(_AM_SCLIENT_SUMMARY_DSC);
    $sform->addElement($summary_text, true);
    // DESCRIPTION
    $description_text = new XoopsFormDhtmlTextArea(_AM_SCLIENT_DESCRIPTION, 'description', $clientObj->description(0, 'e'), 15, 60);
    $description_text->setDescription(_AM_SCLIENT_DESCRIPTION_DSC);
    $sform->addElement($description_text, false);
    // CONTACT_NAME
    $contact_name_text = new XoopsFormText(_CO_SCLIENT_CONTACT_NAME, 'contact_name', 50, 255, $clientObj->contact_name('e'));
    $contact_name_text->setDescription(_CO_SCLIENT_CONTACT_NAME_DSC);
    $sform->addElement($contact_name_text, false);
    // CONTACT_EMAIL
    $contact_email_text = new XoopsFormText(_CO_SCLIENT_CONTACT_EMAIL, 'contact_email', 50, 255, $clientObj->contact_email('e'));
    $contact_email_text->setDescription(_CO_SCLIENT_CONTACT_EMAIL_DSC);
    $sform->addElement($contact_email_text, false);
    // CONTACT_PHONE
    $contact_phone_text = new XoopsFormText(_CO_SCLIENT_CONTACT_PHONE, 'contact_phone', 50, 255, $clientObj->contact_phone('e'));
    $contact_phone_text->setDescription(_CO_SCLIENT_CONTACT_PHONE_DSC);
    $sform->addElement($contact_phone_text, false);
    // ADRESS
    //$adress_text = new XoopsFormText(_CO_SCLIENT_ADRESS, 'adress', 50, 255, $clientObj->adress('e'));
    $adress_text = new XoopsFormTextArea(_CO_SCLIENT_ADRESS, 'adress', $clientObj->adress('e'));
    $adress_text->setDescription(_CO_SCLIENT_ADRESS_DSC);
    $sform->addElement($adress_text, false);
    // STATUS
    $options = $clientObj->getAvailableStatus();
    $status_select = new XoopsFormSelect(_AM_SCLIENT_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SCLIENT_STATUS_DSC);
    $sform->addElement($status_select);
    // WEIGHT
    $weight_text = new XoopsFormText(_AM_SCLIENT_WEIGHT, 'weight', 4, 4, $clientObj->weight());
    $weight_text->setDescription(_AM_SCLIENT_WEIGHT_DSC);
    $sform->addElement($weight_text);
    // Client id
    $sform->addElement(new XoopsFormHidden('id', $clientObj->id()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addclient');
    $button_tray->addElement($hidden);
    $sform->addElement(new XoopsFormHidden('original_status', $clientObj->status()));
    if (!$id) {
        // there's no id? Then it's a new client
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SCLIENT_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SCLIENT_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addclient\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SCLIENT_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SCLIENT_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // else, we're editing an existing client
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SCLIENT_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addclient\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SCLIENT_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    unset($hidden);
    echo "</div>";
}
예제 #6
0
    $nav = new XoopsPageNav($usercount, $limit, $start, "start", $nav_extra);
    $user_select_nav = new XoopsFormLabel(sprintf(_MA_SEARCH_COUNT, $usercount), $nav->renderNav(4));
    $user_select_tray->addElement($user_select_nav);
    $add_button = new XoopsFormButton('', '', _ADD, 'button');
    $add_button->setExtra('onclick="addusers();"');
    $close_button = new XoopsFormButton('', '', _CLOSE, 'button');
    $close_button->setExtra('onclick="window.close()"');
    $button_tray = new XoopsFormElementTray("");
    $button_tray->addElement($add_button);
    $button_tray->addElement(new XoopsFormButton('', '', _CANCEL, 'reset'));
    $button_tray->addElement($close_button);
    $form_user->addElement($user_select_tray);
    if (!empty($_REQUEST["action"])) {
        $group_select = new XoopsFormSelect(_MA_SEARCH_GROUP, 'group', $_REQUEST['group']);
        $group_select->addOptionArray($groups);
        $rank_select = new XoopsFormSelect(_MA_SEARCH_RANK, 'rank', $_REQUEST['rank']);
        $rank_select->addOptionArray($ranks);
        $rank_select->setDescription(_MA_SEARCH_RANK_DESC);
        $form_user->addElement($group_select);
        $form_user->addElement($rank_select);
        $refresh_button = new XoopsFormButton('', '', _MA_SEARCH_REFRESH, 'submit');
        $button_tray->addElement($refresh_button);
    }
    $form_user->addElement(new XoopsFormHidden('action', $_REQUEST["action"]));
    $form_user->addElement(new XoopsFormHidden('target', $_REQUEST["target"]));
    $form_user->addElement(new XoopsFormHidden('multiple', $_REQUEST["multiple"]));
    $form_user->addElement($button_tray);
    $form_user->display();
}
$xoopsOption['output_type'] = "plain";
xoops_cp_footer();
예제 #7
0
// Define scripts
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
$xoTheme->addScript('modules/system/js/admin.js');
switch ($op) {
    case 'list':
    default:
        // Define Breadcrumb and tips
        $xoBreadCrumb->addLink(_AM_SYSTEM_MAINTENANCE_NAV_MANAGER, system_adminVersion('maintenance', 'adminpath'));
        $xoBreadCrumb->addHelp(system_adminVersion('maintenance', 'help'));
        $xoBreadCrumb->addTips(_AM_SYSTEM_MAINTENANCE_TIPS);
        $xoBreadCrumb->render();
        $maintenance = new SystemMaintenance();
        //Form Maintenance
        $form_maintenance = new XoopsThemeForm(_AM_SYSTEM_MAINTENANCE, 'maintenance_save', 'admin.php?fct=maintenance', 'post', true);
        $cache = new XoopsFormSelect(_AM_SYSTEM_MAINTENANCE_CACHE, 'cache', '', 3, true);
        $cache->setDescription(XOOPS_VAR_PATH . '/cache/smarty_cache/<br>' . XOOPS_VAR_PATH . '/cache/smarty_compile/<br>' . XOOPS_VAR_PATH . '/cache/xoops_cache/');
        $cache_arr = array(1 => 'smarty_cache', 2 => 'smarty_compile', 3 => 'xoops_cache');
        $cache->addOptionArray($cache_arr);
        $form_maintenance->addElement($cache);
        $form_maintenance->addElement(new XoopsFormRadioYN(_AM_SYSTEM_MAINTENANCE_SESSION, 'session', '', _YES, _NO));
        $tables_tray = new XoopsFormElementTray(_AM_SYSTEM_MAINTENANCE_TABLES, '');
        $tables_tray->setDescription(_AM_SYSTEM_MAINTENANCE_TABLES_DESC);
        $select_tables = new XoopsFormSelect('', 'tables', '', 7, true);
        $select_tables->addOptionArray($maintenance->displayTables(true));
        $tables_tray->addElement($select_tables, false);
        $tables_tray->addElement(new xoopsFormLabel('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . _AM_SYSTEM_MAINTENANCE_DUMP_AND . '&nbsp;'));
        $choice = new XoopsFormSelect('&nbsp;&nbsp;', 'maintenance', '', 4, true);
        $options = array('1' => _AM_SYSTEM_MAINTENANCE_CHOICE1, '2' => _AM_SYSTEM_MAINTENANCE_CHOICE2, '3' => _AM_SYSTEM_MAINTENANCE_CHOICE3, '4' => _AM_SYSTEM_MAINTENANCE_CHOICE4);
        $choice->addOptionArray($options);
        $tables_tray->addElement($choice, false);
        $form_maintenance->addElement($tables_tray);
예제 #8
0
파일: delivery.php 프로젝트: osw17/oledrion
     $payments_d[$oneitem->getVar('payment_id')] = xoops_trim($oneitem->getVar('payment_title'));
 }
 if (empty($payments_d)) {
     oledrion_utils::redirect(_AM_OLEDRION_DELIVERY_PAYMENTADD, $baseurl, 5);
 }
 if ($edit) {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('dp_delivery', $item->getVar('delivery_id'), '='));
     $deliveryPayments = $h_oledrion_delivery_payment->getObjects($criteria);
     foreach ($deliveryPayments as $oneproduct) {
         $deliveryPayments_d[] = $oneproduct->getVar('dp_payment');
     }
 }
 $paymentSelect = new XoopsFormSelect(_AM_OLEDRION_DELIVERY_PAYMENT, 'payments', $deliveryPayments_d, 5, true);
 $paymentSelect->addOptionArray($payments_d);
 $paymentSelect->setDescription(_AM_OLEDRION_SELECT_HLP);
 $sform->addElement($paymentSelect, true);
 if ($action == 'edit' && $item->pictureExists()) {
     $pictureTray = new XoopsFormElementTray(_AM_OLEDRION_CURRENT_PICTURE, '<br />');
     $pictureTray->addElement(new XoopsFormLabel('', "<img src='" . $item->getPictureUrl() . "' alt='' border='0' />"));
     $deleteCheckbox = new XoopsFormCheckBox('', 'delpicture');
     $deleteCheckbox->addOption(1, _DELETE);
     $pictureTray->addElement($deleteCheckbox);
     $sform->addElement($pictureTray);
     unset($pictureTray, $deleteCheckbox);
 }
 $sform->addElement(new XoopsFormFile(_AM_OLEDRION_PICTURE, 'attachedfile', oledrion_utils::getModuleOption('maxuploadsize')), false);
 $editor = oledrion_utils::getWysiwygForm(_AM_OLEDRION_DESCRIPTION, 'delivery_description', $item->getVar('delivery_description', 'e'), 15, 60, 'description_hidden');
 if ($editor) {
     $sform->addElement($editor, false);
 }
예제 #9
0
function editfolder_text($showmenu = false, $folderid, $languageid)
{
    global $xoopsDB, $smartmedia_folder_handler, $xoopsUser, $myts, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    echo "<script type=\"text/javascript\" src=\"funcs.js\"></script>";
    echo "<style>";
    echo "<!-- ";
    echo "select { width: 130px; }";
    echo "-->";
    echo "</style>";
    $cat_sel = '';
    $folderObj = $smartmedia_folder_handler->get($folderid, $languageid);
    if ($languageid == 'new') {
        $bread_lang = _AM_SMEDIA_CREATE;
    } else {
        $bread_lang = ucfirst($languageid);
    }
    if ($showmenu) {
        smartmedia_adminMenu(2, _AM_SMEDIA_FOLDERS . " > " . _AM_SMEDIA_LANGUAGE_INFO . " > " . $bread_lang);
    }
    echo "<br />\n";
    smartmedia_collapsableBar('bottomtable', 'bottomtableicon');
    echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SMEDIA_FOLDER_LANGUAGE_INFO_EDITING . "</h3>";
    echo "<div id='bottomtable'>";
    echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">" . _AM_SMEDIA_FOLDER_LANGUAGE_INFO_EDITING_INFO . "</span>";
    // 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
    $languageOptions = array();
    $languageList = XoopsLists::getLangList();
    $createdLanguages = $folderObj->getCreatedLanguages();
    foreach ($languageList as $language) {
        if ($languageid != 'new' || !in_array($language, $createdLanguages)) {
            $languageOptions[$language] = $language;
        }
    }
    $language_select = new XoopsFormSelect(_AM_SMEDIA_LANGUAGE_ITEM, 'languageid', $languageid);
    $language_select->addOptionArray($languageOptions);
    $language_select->setDescription(_AM_SMEDIA_LANGUAGE_ITEM_DSC);
    if ($languageid != 'new') {
        $language_select->setExtra(smartmedia_make_control_disabled());
        $sform->addElement(new XoopsFormHidden('languageid', $languageid));
    }
    $sform->addElement($language_select, true);
    // title
    $sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_TITLE, 'title', 50, 255, $folderObj->title()), true);
    // title
    $sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_TITLE_REQ, 'title', 50, 255, $folderObj->title()), true);
    // short_title
    //$sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_SHORT_TITLE, 'short_title', 50, 255, $folderObj->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'));
    // Action buttons tray
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addfolder_text');
    $button_tray->addElement($hidden);
    if ($languageid == 'new') {
        // We are creating a new folder language info
        $butt_create = new XoopsFormButton('', '', _AM_SMEDIA_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfolder_text\'"');
        $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 language info
        $butt_create = new XoopsFormButton('', '', _AM_SMEDIA_MODIFY, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfolder_text\'"');
        $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);
}
$form_family->addOption("parent", _LANG_WLA_CHECK_PARENT);
$form_family->addOption("sibling", _LANG_WLA_CHECK_SIBLING);
$form_family->addOption("spouse", _LANG_WLA_CHECK_SPOUSE);
$form_family->addOption("", _LANG_WLA_CHECK_NONE);
$form_xfn->addElement($form_family);
$form_romantic = new XoopsFormCheckBox(_LANG_WLA_SUB_ROMANTIC . "&nbsp;:&nbsp;", "romantic", $romantic);
$form_romantic->setExtra('class="valinp"');
$form_romantic->addOption("muse", _LANG_WLA_CHECK_MUSE);
$form_romantic->addOption("crush", _LANG_WLA_CHECK_CRUSH);
$form_romantic->addOption("date", _LANG_WLA_CHECK_DATE);
$form_romantic->addOption("sweetheart", _LANG_WLA_CHECK_HEART);
$form_xfn->addElement($form_romantic);
$form->addElement($form_xfn);
$form->addElement(new XoopsFormTextArea(_LANG_WLA_SUB_NOTE, "link_notes", $link_notes, 10, 60));
$form_rating = new XoopsFormSelect(_LANG_WLA_SUB_RATE, "link_rating", $link_rating);
$form_rating->setDescription(_LANG_WLA_CHECK_ZERO);
for ($r = 0; $r < 10; $r++) {
    $form_rating->addOption($r, $r);
}
$form->addElement($form_rating);
$form_target = new XoopsFormRadio(_LANG_WLA_SUB_TARGET, "link_target", $link_target);
$form_target->setDescription(_LANG_WLA_CHECK_STRICT);
$form_target->addOption('_blank', '_blank');
$form_target->addOption('_top', '_top');
$form_target->addOption('', "none");
$form->addElement($form_target);
$form_visible = new XoopsFormRadio(_LANG_WLA_SUB_VISIBLE, "link_visible", $link_visible);
$form_visible->addOption('Y', 'Yes');
$form_visible->addOption('N', 'No');
$form->addElement($form_visible);
$form_category = new XoopsFormSelect(_LANG_WLA_SUB_CAT, "link_category", $link_category);
예제 #11
0
 echo '<h3>' . _AM_MYSEARCH_BLACKLIST . '</h3>';
 $sform = new XoopsThemeForm(_AM_MYSEARCH_BLACKLIST, 'MetagenBlackList', XOOPS_URL . '/modules/mysearch/admin/index.php', 'post');
 $sform->addElement(new XoopsFormHidden('op', 'MetagenBlackList'), false);
 // Remove words
 $remove_tray = new XoopsFormElementTray(_AM_MYSEARCH_BLACKLIST);
 $remove_tray->setDescription(_AM_MYSEARCH_BLACKLIST_DESC);
 $blacklist = new XoopsFormSelect('', 'blacklist', '', 5, true);
 $words = array();
 $metablack = new mysearch_blacklist();
 $words = $metablack->getAllKeywords();
 if (is_array($words) && count($words) > 0) {
     foreach ($words as $key => $value) {
         $blacklist->addOption($key, $value);
     }
 }
 $blacklist->setDescription(_AM_MYSEARCH_BLACKLIST_DESC);
 $remove_tray->addElement($blacklist, false);
 $remove_btn = new XoopsFormButton('', 'go', _AM_MYSEARCH_DELETE, 'submit');
 $remove_tray->addElement($remove_btn, false);
 $sform->addElement($remove_tray);
 // Add some words
 $add_tray = new XoopsFormElementTray(_AM_MYSEARCH_BLACKLIST_ADD);
 $add_tray->setDescription(_AM_MYSEARCH_BLACKLIST_ADD_DSC);
 $add_field = new XoopsFormTextArea('', 'keywords', '', 5, 70);
 $add_tray->addElement($add_field, false);
 $add_btn = new XoopsFormButton('', 'go', _AM_MYSEARCH_BLACKLIST_ADD, 'submit');
 $add_tray->addElement($add_btn, false);
 $sform->addElement($add_tray);
 $sform->display();
 echo "<br /><div align='center'><a href='http://xoops.instant-zero.com' target='_blank'><img src='../images/instantzero.gif'></a></div>";
 break;
예제 #12
0
function edititem($showmenu = false, $itemid = 0, $clone = false)
{
    global $smartsection_current_page, $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    include_once SMARTSECTION_ROOT_PATH . '/class/formdatetime.php';
    // if there is a parameter, and the id exists, retrieve data: we're editing a item
    if ($itemid != 0) {
        // Creating the ITEM object
        $itemObj = $smartsection_item_handler->get($itemid);
        if (!$itemObj) {
            redirect_header("item.php", 1, _AM_SSECTION_NOITEMSELECTED);
            exit;
        }
        if ($clone) {
            $itemObj->setNew();
            $itemObj->setVar('status', _SSECTION_STATUS_NOTSET);
            $itemObj->setVar('datesub', time());
        }
        switch ($itemObj->status()) {
            case _SSECTION_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SSECTION_SUBMITTED;
                $breadcrumb_action2 = _AM_SSECTION_APPROVING;
                $page_title = _AM_SSECTION_SUBMITTED_TITLE;
                $page_info = _AM_SSECTION_SUBMITTED_INFO;
                $button_caption = _AM_SSECTION_APPROVE;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
            case _SSECTION_STATUS_PUBLISHED:
                $breadcrumb_action1 = _AM_SSECTION_PUBLISHED;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_PUBLISHEDEDITING;
                $page_info = _AM_SSECTION_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
            case _SSECTION_STATUS_OFFLINE:
                $breadcrumb_action1 = _AM_SSECTION_OFFLINE;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_OFFLINEEDITING;
                $page_info = _AM_SSECTION_OFFLINEEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_OFFLINE;
                break;
            case _SSECTION_STATUS_REJECTED:
                $breadcrumb_action1 = _AM_SSECTION_REJECTED;
                $breadcrumb_action2 = _AM_SSECTION_REJECTED;
                $page_title = _AM_SSECTION_REJECTED_EDIT;
                $page_info = _AM_SSECTION_REJECTED_EDIT_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_REJECTED;
                break;
            case _SSECTION_STATUS_NOTSET:
                // Then it's a clone...
                $breadcrumb_action1 = _AM_SSECTION_ITEMS;
                $breadcrumb_action2 = _AM_SSECTION_CLONE_NEW;
                $button_caption = _AM_SSECTION_CREATE;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                $page_title = _AM_SSECTION_ITEM_DUPLICATING;
                $page_info = _AM_SSECTION_ITEM_DUPLICATING_DSC;
                break;
            case "default":
            default:
                $breadcrumb_action1 = _AM_SSECTION_ITEMS;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_PUBLISHEDEDITING;
                $page_info = _AM_SSECTION_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
        }
        $categoryObj = $itemObj->category();
        if ($showmenu) {
            smartsection_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        smartsection_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info);
        if (!$clone) {
            echo "<form><div style=\"margin-bottom: 10px;\">";
            echo "<input type='button' name='button' onclick=\"location='item.php?op=clone&itemid=" . $itemObj->itemid() . "'\" value='" . _AM_SSECTION_CLONE_ITEM . "'>&nbsp;&nbsp;";
            echo "</div></form>";
        }
    } else {
        // there's no parameter, so we're adding an item
        $itemObj =& $smartsection_item_handler->create();
        $itemObj->setVar('uid', $xoopsUser->uid());
        $categoryObj =& $smartsection_category_handler->create();
        $breadcrumb_action1 = _AM_SSECTION_ITEMS;
        $breadcrumb_action2 = _AM_SSECTION_CREATINGNEW;
        $button_caption = _AM_SSECTION_CREATE;
        $new_status = _SSECTION_STATUS_PUBLISHED;
        if ($showmenu) {
            smartsection_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0;
        $categoryObj->setVar('categoryid', $sel_categoryid);
        smartsection_collapsableBar('createitemtable', 'createitemicon', _AM_SSECTION_ITEM_CREATING, _AM_SSECTION_ITEM_CREATING_DSC);
    }
    // ITEM FORM
    $sform = new XoopsThemeForm(_AM_SSECTION_ITEMS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // CATEGORY
    $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
    ob_start();
    //$sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid()));
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $category_label = new XoopsFormLabel(_AM_SSECTION_CATEGORY, ob_get_contents());
    $category_label->setDescription(_AM_SSECTION_CATEGORY_DSC);
    $sform->addElement($category_label);
    ob_end_clean();
    // TITLE
    $title_text = new XoopsFormText(_AM_SSECTION_TITLE, 'title', 50, 255, $itemObj->title(0, 'e'));
    $sform->addElement($title_text, true);
    if (SMARTSECTION_LEVEL >= 5) {
        // SUMMARY
        $summary_text = smartsection_getEditor(_AM_SSECTION_SUMMARY, 'summary', $itemObj->getVar('summary', 'e'));
        $summary_text->setDescription(_AM_SSECTION_SUMMARY_DSC);
        $sform->addElement($summary_text, false);
        // DISPLAY_SUMMARY
        $display_summary_radio = new XoopsFormRadioYN(_AM_SSECTION_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
        $sform->addElement($display_summary_radio);
    }
    // BODY
    /*if ($itemObj->address()) {
    		// Main body : pagewrap
    		$address_select = new XoopsFormSelect(_AM_SSECTION_BODY_SELECTFILE, "address", $itemObj->address());
    		$address_select->setDescription(_AM_SSECTION_BODY_SELECTFILE_DSC);
    	    $dir = smartsection_getUploadDir(true, 'content');
    		$folder = dir($dir);
    		while($file = $folder->read()) {
    	      if ($file != "." && $file != "..") {
    		     $address_select->addOption($file, "".$file."");
    		  }
    		}
    	    $folder->close();
    		$sform->addElement($address_select);
    
    		$sform->addElement(new XoopsFormHidden('body', ''));
    	} else {*/
    $body_text = smartsection_getEditor(_AM_SSECTION_BODY, 'body', $itemObj->getVar('body', 'e'));
    if (SMARTSECTION_LEVEL >= 5) {
        $body_text->setDescription(sprintf(_AM_SSECTION_BODY_DSC, SMARTSECTION_URL . "/admin/pagewrap_lookup.php"));
    }
    $sform->addElement($body_text);
    //}
    if (SMARTSECTION_LEVEL >= 5) {
        // Available pages to wrap
        $wrap_pages = XoopsLists::getHtmlListAsArray(smartsection_getUploadDir(true, 'content'));
        $available_wrap_pages_text = array();
        foreach ($wrap_pages as $page) {
            $available_wrap_pages_text[] = "<span onclick='smartsectionPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
        }
        $available_wrap_pages = new XoopsFormLabel(_AM_SSECTION_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text));
        $available_wrap_pages->setDescription(_AM_SSECTION_AVAILABLE_PAGE_WRAP_DSC);
        $sform->addElement($available_wrap_pages);
        // Tags
        if (smartsection_tag_module_included()) {
            include_once XOOPS_ROOT_PATH . "/modules/tag/include/formtag.php";
            $text_tags = new XoopsFormTag("item_tag", 60, 255, $itemObj->getVar('item_tag', 'e'), 0);
            $sform->addElement($text_tags);
        }
        // IMAGE
        $image_array = XoopsLists::getImgListAsArray(smartsection_getImageDir('item'));
        $image_select = new XoopsFormSelect('', 'image', $itemObj->image());
        //$image_select -> addOption ('-1', '---------------');
        $image_select->addOptionArray($image_array);
        $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'");
        $image_tray = new XoopsFormElementTray(_AM_SSECTION_IMAGE_ITEM, '&nbsp;');
        $image_tray->addElement($image_select);
        $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />"));
        $image_tray->setDescription(_AM_SSECTION_IMAGE_ITEM_DSC);
        $sform->addElement($image_tray);
        // IMAGE UPLOAD
        $max_size = 5000000;
        $image_file_box = new XoopsFormFile(_AM_SSECTION_IMAGE_UPLOAD, "image_file", $max_size);
        $image_file_box->setExtra("size ='50'");
        $image_file_box->setDescription(_AM_SSECTION_IMAGE_UPLOAD_ITEM_DSC);
        $sform->addElement($image_file_box);
    }
    // File upload UPLOAD
    $file_box = new XoopsFormFile(smartsection_new_feature_tag() . _AM_SSECTION_ITEM_UPLOAD_FILE, "userfile", 0);
    $file_box->setDescription(_AM_SSECTION_ITEM_UPLOAD_FILE_DSC . smartsection_new_feature_tag());
    $file_box->setExtra("size ='50'");
    $sform->addElement($file_box);
    // Uid
    /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
    	    the method users::getobjects encounters a memory error
    	*/
    $uid = $itemObj->uid();
    $uid_select = new XoopsFormSelect(_AM_SSECTION_UID, 'uid', $uid, 1, false);
    $uid_select->setDescription(_AM_SSECTION_UID_DSC);
    $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC";
    $result = $xoopsDB->query($sql);
    $users_array = array();
    $users_array[0] = $xoopsConfig['anonymous'];
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $users_array[$myrow['uid']] = $myrow['uname'];
    }
    $uid_select->addOptionArray($users_array);
    $sform->addElement($uid_select);
    // Datesub
    $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub');
    $datesub_datetime = new SmartsectionFormDateTime(_AM_SSECTION_DATESUB, 'datesub', $size = 15, $datesub);
    $datesub_datetime->setDescription(_AM_SSECTION_DATESUB_DSC);
    $sform->addElement($datesub_datetime);
    // STATUS
    $options = array(_SSECTION_STATUS_PUBLISHED => _AM_SSECTION_PUBLISHED, _SSECTION_STATUS_OFFLINE => _AM_SSECTION_OFFLINE, _SSECTION_STATUS_SUBMITTED => _AM_SSECTION_SUBMITTED, _SSECTION_STATUS_REJECTED => _AM_SSECTION_REJECTED);
    $status_select = new XoopsFormSelect(_AM_SSECTION_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SSECTION_STATUS_DSC);
    $sform->addElement($status_select);
    if (SMARTSECTION_LEVEL > 0) {
        // Short url
        $text_short_url = new XoopsFormText(_AM_SSECTION_ITEM_SHORT_URL, 'short_url', 50, 255, $itemObj->short_url('e'));
        $text_short_url->setDescription(_AM_SSECTION_ITEM_SHORT_URL_DSC);
        $sform->addElement($text_short_url);
        // Meta Keywords
        $text_meta_keywords = new XoopsFormTextArea(_AM_SSECTION_ITEM_META_KEYWORDS, 'meta_keywords', $itemObj->meta_keywords('e'), 7, 60);
        $text_meta_keywords->setDescription(_AM_SSECTION_ITEM_META_KEYWORDS_DSC);
        $sform->addElement($text_meta_keywords);
        // Meta Description
        $text_meta_description = new XoopsFormTextArea(_AM_SSECTION_ITEM_META_DESCRIPTION, 'meta_description', $itemObj->meta_description('e'), 7, 60);
        $text_meta_description->setDescription(_AM_SSECTION_ITEM_META_DESCRIPTION_DSC);
        $sform->addElement($text_meta_description);
    }
    // WEIGHT
    $sform->addElement(new XoopsFormText(_AM_SSECTION_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true);
    if (SMARTSECTION_LEVEL >= 5) {
        // COMMENTS
        $addcomments_radio = new XoopsFormRadioYN(_AM_SSECTION_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
        $sform->addElement($addcomments_radio);
    }
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list = $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read());
    $groups_checkbox->setDescription(_AM_SSECTION_PERMISSIONS_ITEM_DSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_checkbox);
    $p_view_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PARTIAL_VIEW, 'partial_view[]', $itemObj->partial_view());
    $p_view_checkbox->setDescription(_AM_SSECTION_PARTIAL_VIEWDSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $p_view_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($p_view_checkbox);
    /*$partial_view_radio = new XoopsFormRadioYN(_AM_SSECTION_PARTIAL_VIEW, 'partial_view', $itemObj->partial_view(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
    	$partial_view_radio->setDescription(_AM_SSECTION_PARTIAL_VIEWDSC);
    	$sform->addElement($partial_view_radio);*/
    if (SMARTSECTION_LEVEL >= 5) {
        // VARIOUS OPTIONS
        $options_tray = new XoopsFormElementTray(_AM_SSECTION_OPTIONS, '<br />');
        $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml());
        $html_checkbox->addOption(1, _AM_SSECTION_DOHTML);
        $options_tray->addElement($html_checkbox);
        $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley());
        $smiley_checkbox->addOption(1, _AM_SSECTION_DOSMILEY);
        $options_tray->addElement($smiley_checkbox);
        $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode());
        $xcodes_checkbox->addOption(1, _AM_SSECTION_DOXCODE);
        $options_tray->addElement($xcodes_checkbox);
        $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage());
        $images_checkbox->addOption(1, _AM_SSECTION_DOIMAGE);
        $options_tray->addElement($images_checkbox);
        $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr());
        $linebreak_checkbox->addOption(1, _AM_SSECTION_DOLINEBREAK);
        $options_tray->addElement($linebreak_checkbox);
        $sform->addElement($options_tray);
    }
    // item ID
    if ($clone) {
        $itemid = 0;
    }
    $sform->addElement(new XoopsFormHidden('itemid', $itemid));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'additem');
    $button_tray->addElement($hidden);
    if (!$itemid) {
        // there's no itemid? Then it's a new item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SSECTION_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SSECTION_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SSECTION_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SSECTION_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        smartsection_close_collapsable('createitemtable', 'createitemicon');
    } else {
        // else, we're editing an existing item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SSECTION_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SSECTION_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        smartsection_close_collapsable('edititemtable', 'edititemicon');
    }
    if (SMARTSECTION_LEVEL >= 5) {
        smartsection_collapsableBar('pagewraptable', 'pagewrapicon', _AM_SSECTION_PAGEWRAP, _AM_SSECTION_PAGEWRAPDSC);
        $dir = smartsection_getUploadDir(true, 'content');
        if (!eregi("777", decoct(fileperms($dir)))) {
            echo "<font color='FF0000'><h4>" . _AM_SSECTION_PERMERROR . "</h4></font>";
        }
        // Upload File
        echo "<form name='form_name2' id='form_name2' action='pw_upload_file.php' method='post' enctype='multipart/form-data'>";
        echo "<table cellspacing='1' width='100%' class='outer'>";
        echo "<tr><th colspan='2'>" . _AM_SSECTION_UPLOAD_FILE . "</th></tr>";
        echo "<tr valign='top' align='left'><td class='head'>" . _AM_SSECTION_SEARCH_PW . "</td><td class='even'><input type='file' name='fileupload' id='fileupload' size='30' /></td></tr>";
        echo "<tr valign='top' align='left'><td class='head'><input type='hidden' name='MAX_FILE_SIZE' id='op' value='500000' /></td><td class='even'><input type='submit' name='submit' value='" . _AM_SSECTION_UPLOAD . "' /></td></tr>";
        echo "<input type='hidden' name='backto' value='{$smartsection_current_page}'/>";
        echo "</table>";
        echo "</form>";
        // Delete File
        $form = new XoopsThemeForm(_AM_SSECTION_DELETEFILE, "form_name", "pw_delete_file.php");
        $pWrap_select = new XoopsFormSelect(smartsection_getUploadDir(true, 'content'), "address");
        $folder = dir($dir);
        while ($file = $folder->read()) {
            if ($file != "." && $file != "..") {
                $pWrap_select->addOption($file, $file);
            }
        }
        $folder->close();
        $form->addElement($pWrap_select);
        $delfile = "delfile";
        $form->addElement(new XoopsFormHidden('op', $delfile));
        $submit = new XoopsFormButton("", "submit", _AM_SSECTION_BUTTON_DELETE, "submit");
        $form->addElement($submit);
        $form->addElement(new XoopsFormHidden('backto', $smartsection_current_page));
        $form->display();
        smartsection_close_collapsable('pagewraptable', 'pagewrapicon');
    }
    unset($hidden);
    if ($itemid != 0) {
        showfiles($itemObj);
    }
}
예제 #13
0
function createFieldList($val, $textbox = false, $limitToForm = false, $name = "", $firstValue = "", $multi_select = false)
{
    global $xoopsDB;
    array($formids);
    array($formnames);
    array($totalcaptionlist);
    array($totalvaluelist);
    $captionlistindex = 0;
    if ($limitToForm) {
        $limitToForm = " WHERE id_form = " . intval($limitToForm);
    } else {
        $limitToForm = "";
    }
    if (!$name) {
        $name = 'formlink';
    }
    $formlist = "SELECT id_form, desc_form FROM " . $xoopsDB->prefix("formulize_id") . " {$limitToForm} ORDER BY desc_form";
    $resformlist = $xoopsDB->query($formlist);
    if ($resformlist) {
        // loop through each form
        while ($rowformlist = $xoopsDB->fetchRow($resformlist)) {
            $fieldnames = "SELECT ele_caption, ele_id, ele_handle FROM " . $xoopsDB->prefix("formulize") . " WHERE id_form={$rowformlist['0']} ORDER BY ele_order";
            $resfieldnames = $xoopsDB->query($fieldnames);
            // loop through each caption in the current form
            while ($rowfieldnames = $xoopsDB->fetchRow($resfieldnames)) {
                // write formname: caption to the master array that will be passed to the select box.
                $totalcaptionlist[$captionlistindex] = printSmart(trans($rowformlist[1])) . ": " . printSmart(trans($rowfieldnames[0]), 50);
                $totalvaluelist[$captionlistindex] = $rowfieldnames[1];
                // if this is the selected entry
                if ($val == $totalvaluelist[$captionlistindex] or $val == $rowformlist[0] . "#*=:*" . $rowfieldnames[2]) {
                    $defaultlinkselection = $captionlistindex;
                }
                $captionlistindex++;
            }
        }
    }
    if ($textbox) {
        $am_ele_formlink = _AM_ELE_FORMLINK_TEXTBOX;
        $am_formlink_none = _AM_FORMLINK_NONE_TEXTBOX;
        $am_ele_formlink_desc = _AM_ELE_FORMLINK_DESC_TEXTBOX;
    } else {
        $am_ele_formlink = _AM_ELE_FORMLINK;
        $am_formlink_none = _AM_FORMLINK_NONE;
        $am_ele_formlink_desc = _AM_ELE_FORMLINK_DESC;
    }
    if ($firstValue) {
        // let a passed in value override the defaults
        $am_formlink_none = $firstValue;
    }
    // make the select box and add all the options
    $formlink = new XoopsFormSelect($am_ele_formlink, $name, '', $multi_select ? 8 : 1, $multi_select);
    $formlink->addOption("none", $am_formlink_none);
    for ($i = 0; $i < $captionlistindex; $i++) {
        $formlink->addOption($totalvaluelist[$i], htmlspecialchars(strip_tags($totalcaptionlist[$i])));
    }
    if (isset($defaultlinkselection)) {
        $formlink->setValue($totalvaluelist[$defaultlinkselection]);
    }
    $formlink->setDescription($am_ele_formlink_desc);
    if (!$textbox) {
        // return two pieces of info for selectboxes, since we need to know the element selected
        $to_return = array();
        $to_return[] = $formlink;
        $to_return[] = isset($defaultlinkselection) ? $totalvaluelist[$defaultlinkselection] : "";
        return $to_return;
    } else {
        return $formlink;
    }
}
예제 #14
0
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
if (!$itemObj->categoryid() && isset($_GET['categoryid'])) {
    $categoryid = $_GET['categoryid'];
} else {
    $categoryid = $itemObj->categoryid();
}
if (isset($_GET['op']) && $_GET['op'] == 'clone') {
    $title = _MD_SSECTION_SUB_CLONE;
} else {
    $title = _MD_SSECTION_SUB_SMNAME;
}
$sform = new XoopsThemeForm($title, "form", xoops_getenv('PHP_SELF'));
$sform->setExtra('enctype="multipart/form-data"');
// Category
$category_select = new XoopsFormSelect(_MD_SSECTION_CATEGORY, 'categoryid', $categoryid);
$category_select->setDescription(_MD_SSECTION_CATEGORY_DSC);
$category_select->addOptionArray($categoriesArray);
$sform->addElement($category_select);
// ITEM TITLE
$sform->addElement(new XoopsFormText(_MD_SSECTION_TITLE, 'title', 50, 255, $itemObj->title('e')), true);
// SUMMARY
$summary_text = smartsection_getEditor(_MD_SSECTION_SUMMARY, 'summary', $itemObj->getVar('summary'));
$summary_text->setDescription(_MD_SSECTION_SUMMARY_DSC);
$sform->addElement($summary_text, false);
// BODY
//$body_text = new XoopsFormDhtmlTextArea(_MD_SSECTION_BODY, 'body', '', 15, 60);
$body_text = smartsection_getEditor(_MD_SSECTION_BODY_REQ, 'body', $itemObj->getVar('body'));
$body_text->setDescription(_MD_SSECTION_BODY_DSC);
$sform->addElement($body_text);
// IMAGE
$image_array =& XoopsLists::getImgListAsArray(smartsection_getImageDir('item'));
예제 #15
0
function editField()
{
    global $oAdminButton;
    $eventsrv =& xhelpNewEventService();
    $session =& Session::singleton();
    $regex_array =& _getRegexArray();
    if (!isset($_REQUEST['id'])) {
        redirect_header(xhelpMakeURI(XHELP_ADMIN_URL . '/fields.php', array('op' => 'manageDepartments'), false), 3, _AM_XHELP_MESSAGE_NO_FIELD);
    }
    $fld_id = intval($_REQUEST['id']);
    $hField =& xhelpGetHandler('ticketField');
    if (!($field =& $hField->get($fld_id))) {
        redirect_header(xhelpMakeURI(XHELP_ADMIN_URL . '/fields.php', array('op' => 'manageDepartments'), false), 3, _AM_XHELP_MESSAGE_NO_FIELD);
    }
    if (!isset($_POST['editField'])) {
        //Get Custom Field From session (if exists)
        $field_info = $session->get('xhelp_editField_' . $fld_id);
        $field_errors = $session->get('xhelp_editFieldErrors_' . $fld_id);
        if (!$field_info === false) {
            $fld_controltype = $field_info['controltype'];
            $fld_datatype = $field_info['datatype'];
            $fld_departments = $field_info['departments'];
            $fld_name = $field_info['name'];
            $fld_fieldname = $field_info['fieldname'];
            $fld_description = $field_info['description'];
            $fld_required = $field_info['required'];
            $fld_length = $field_info['length'];
            $fld_weight = $field_info['weight'];
            $fld_defaultvalue = $field_info['defaultvalue'];
            $fld_values = $field_info['values'];
            $fld_validation = $field_info['validation'];
        } else {
            $hFDept =& xhelpGetHandler('ticketFieldDepartment');
            $depts =& $hFDept->departmentsByField($field->getVar('id'), true);
            $fld_controltype = $field->getVar('controltype');
            $fld_datatype = $field->getVar('datatype');
            $fld_departments = array_keys($depts);
            $fld_name = $field->getVar('name');
            $fld_fieldname = $field->getVar('fieldname');
            $fld_description = $field->getVar('description');
            $fld_required = $field->getVar('required');
            $fld_length = $field->getVar('fieldlength');
            $fld_weight = $field->getVar('weight');
            $fld_defaultvalue = $field->getVar('defaultvalue');
            $fld_values = _formatValues($field->getVar('fieldvalues'));
            $fld_validation = $field->getVar('validation');
        }
        //Display Field modification
        xoops_cp_header();
        echo $oAdminButton->renderButtons('manfields');
        //Edit Field Form
        $controls = xhelpGetControlArray();
        $control_select = new XoopsFormSelect(_AM_XHELP_TEXT_CONTROLTYPE, 'fld_controltype', $fld_controltype);
        $control_select->setDescription(_AM_XHELP_TEXT_CONTROLTYPE_DESC);
        foreach ($controls as $key => $control) {
            $control_select->addOption($key, $control['label']);
        }
        $datatypes = array(_XHELP_DATATYPE_TEXT => _XHELP_DATATYPE_TEXT, _XHELP_DATATYPE_NUMBER_INT => _XHELP_DATATYPE_NUMBER_INT, _XHELP_DATATYPE_NUMBER_DEC => _XHELP_DATATYPE_NUMBER_DEC);
        $datatype_select = new XoopsFormSelect(_AM_XHELP_TEXT_DATATYPE, 'fld_datatype', $fld_datatype);
        $datatype_select->setDescription(_AM_XHELP_TEXT_DATATYPE_DESC);
        $datatype_select->addOptionArray($datatypes);
        $hDepts =& xhelpGetHandler('department');
        $depts =& $hDepts->getObjects();
        $dept_select = new XoopsFormSelect(_AM_XHELP_TEXT_DEPARTMENTS, 'fld_departments', $fld_departments, 5, true);
        $dept_select->setDescription(_AM_XHELP_TEXT_DEPT_DESC);
        foreach ($depts as $obj) {
            $dept_select->addOption($obj->getVar('id'), $obj->getVar('department'));
        }
        unset($depts);
        if (!$field_errors === false) {
            xhelpRenderErrors($field_errors, xhelpMakeURI(XHELP_ADMIN_URL . '/fields.php', array('op' => 'clearEditSession', 'id' => $fld_id)));
        }
        $form = new xhelpForm(_AM_XHELP_EDIT_FIELD, 'edit_field', xhelpMakeURI(XHELP_ADMIN_URL . '/fields.php', array('op' => 'editfield', 'id' => $fld_id)));
        $nameEle = new XoopsFormText(_AM_XHELP_TEXT_NAME, 'fld_name', 30, 64, $fld_name);
        $nameEle->setDescription(_AM_XHELP_TEXT_NAME_DESC);
        $form->addElement($nameEle);
        $fieldnameEle = new XoopsFormText(_AM_XHELP_TEXT_FIELDNAME, 'fld_fieldname', 30, 64, $fld_fieldname);
        $fieldnameEle->setDescription(_AM_XHELP_TEXT_FIELDNAME_DESC);
        $form->addElement($fieldnameEle);
        $descriptionEle = new XoopsFormTextArea(_AM_XHELP_TEXT_DESCRIPTION, 'fld_description', $fld_description, 5, 60);
        $descriptionEle->setDescription(_AM_XHELP_TEXT_DESCRIPTION_DESC);
        $form->addElement($descriptionEle);
        $form->addElement($dept_select);
        $form->addElement($control_select);
        $form->addElement($datatype_select);
        $required = new XoopsFormRadioYN(_AM_XHELP_TEXT_REQUIRED, 'fld_required', $fld_required);
        $required->setDescription(_AM_XHELP_TEXT_REQUIRED_DESC);
        $form->addElement($required);
        $lengthEle = new XoopsFormText(_AM_XHELP_TEXT_LENGTH, 'fld_length', 5, 5, $fld_length);
        $lengthEle->setDescription(_AM_XHELP_TEXT_LENGTH_DESC);
        $form->addElement($lengthEle);
        $widthEle = new XoopsFormText(_AM_XHELP_TEXT_WEIGHT, 'fld_weight', 5, 5, $fld_weight);
        $widthEle->setDescription(_AM_XHELP_TEXT_WEIGHT_DESC);
        $form->addElement($widthEle);
        $regex_control = new xhelpFormRegex(_AM_XHELP_TEXT_VALIDATION, 'fld_valid', $fld_validation);
        $regex_control->setDescription(_AM_XHELP_TEXT_VALIDATION_DESC);
        $regex_control->addOptionArray($regex_array);
        $form->addElement($regex_control);
        $defaultValueEle = new XoopsFormText(_AM_XHELP_TEXT_DEFAULTVALUE, 'fld_defaultvalue', 30, 100, $fld_defaultvalue);
        $defaultValueEle->setDescription(_AM_XHELP_TEXT_DEFAULTVALUE_DESC);
        $form->addElement($defaultValueEle);
        $values = new XoopsFormTextArea(_AM_XHELP_TEXT_FIELDVALUES, 'fld_values', $fld_values, 5, 60);
        $values->setDescription(_AM_XHELP_TEXT_FIELDVALUES_DESC);
        $form->addElement($values);
        $btn_tray = new XoopsFormElementTray('');
        $btn_tray->addElement(new XoopsFormButton('', 'editField', _AM_XHELP_BUTTON_SUBMIT, 'submit'));
        $btn_tray->addElement(new XoopsFormButton('', 'cancel', _AM_XHELP_BUTTON_CANCEL));
        $btn_tray->addElement(new XoopsFormHidden('id', $fld_id));
        $form->addElement($btn_tray);
        echo $form->render();
        xhelpAdminFooter();
        xoops_cp_footer();
    } else {
        //Validate Field Information
        $has_errors = false;
        $errors = array();
        $values =& _parseValues($_POST['fld_values']);
        if (!($control = xhelpGetControl($_POST['fld_controltype']))) {
            $has_errors = true;
            $errors['fld_controltype'][] = _AM_XHELP_VALID_ERR_CONTROLTYPE;
        }
        $fld_needslength = $control['needs_length'];
        $fld_needsvalues = $control['needs_values'];
        //name field filled?
        if (trim($_POST['fld_name']) == '') {
            $has_errors = true;
            $errors['fld_name'][] = _AM_XHELP_VALID_ERR_NAME;
        }
        //fieldname filled
        if (trim($_POST['fld_fieldname']) == '') {
            $has_errors = true;
            $errors['fld_fieldname'][] = _AM_XHELP_VALID_ERR_FIELDNAME;
        }
        //fieldname unique?
        $crit = new CriteriaCompo(new Criteria('id', $fld_id, '!='));
        $crit->add(new Criteria('fieldname', $_POST['fld_fieldname']));
        if ($hField->getCount($crit)) {
            $has_errors = true;
            $errors['fld_fieldname'][] = _AM_XHELP_VALID_ERR_FIELDNAME_UNIQUE;
        }
        //Length filled
        if (intval($_POST['fld_length']) == 0 && $fld_needslength == true) {
            $has_errors = true;
            $errors['fld_length'][] = sprintf(_AM_XHELP_VALID_ERR_LENGTH, _XHELP_FIELD_MINLEN, _XHELP_FIELD_MAXLEN);
        }
        //default value in value set?
        if (count($values)) {
            if (!in_array($_POST['fld_defaultvalue'], $values, true) && !array_key_exists($_POST['fld_defaultvalue'], $values)) {
                $has_errors = true;
                $errors['fld_defaultvalue'][] = _AM_XHELP_VALID_ERR_DEFAULTVALUE;
            }
            //length larger than longest value?
            $length = intval($_POST['fld_length']);
            foreach ($values as $key => $value) {
                if (strlen($key) > $length) {
                    $has_errors = true;
                    $errors['fld_values'][] = sprintf(_AM_XHELP_VALID_ERR_VALUE_LENGTH, htmlentities($key), $length);
                }
            }
        } elseif ($fld_needsvalues) {
            $has_errors = true;
            $errors['fld_values'][] = _AM_XHELP_VALID_ERR_VALUE;
        }
        if ($has_errors) {
            $afield = array();
            $afield['name'] = $_POST['fld_name'];
            $afield['description'] = $_POST['fld_description'];
            $afield['fieldname'] = $_POST['fld_fieldname'];
            $afield['departments'] = $_POST['fld_departments'];
            $afield['controltype'] = $_POST['fld_controltype'];
            $afield['datatype'] = $_POST['fld_datatype'];
            $afield['required'] = $_POST['fld_required'];
            $afield['weight'] = $_POST['fld_weight'];
            $afield['defaultvalue'] = $_POST['fld_defaultvalue'];
            $afield['values'] = $_POST['fld_values'];
            $afield['length'] = $_POST['fld_length'];
            $afield['validation'] = $_POST['fld_valid_select'] == $_POST['fld_valid_txtbox'] ? $_POST['fld_valid_select'] : $_POST['fld_valid_txtbox'];
            $session->set('xhelp_editField_' . $fld_id, $afield);
            $session->set('xhelp_editFieldErrors_' . $fld_id, $errors);
            //Redirect to edit page (display errors);
            header('Location: ' . xhelpMakeURI(XHELP_ADMIN_URL . '/fields.php', array('op' => 'editfield', 'id' => $fld_id), false));
            exit;
        }
        //Store Modified Field info
        $field->setVar('name', $_POST['fld_name']);
        $field->setVar('description', $_POST['fld_description']);
        $field->setVar('fieldname', $_POST['fld_fieldname']);
        $field->setVar('controltype', $_POST['fld_controltype']);
        $field->setVar('datatype', $_POST['fld_datatype']);
        $field->setVar('fieldlength', $_POST['fld_length']);
        $field->setVar('required', $_POST['fld_required']);
        $field->setVar('weight', $_POST['fld_weight']);
        $field->setVar('defaultvalue', $_POST['fld_defaultvalue']);
        $field->setVar('validation', $_POST['fld_valid_select'] == $_POST['fld_valid_txtbox'] ? $_POST['fld_valid_select'] : $_POST['fld_valid_txtbox']);
        $field->setValues($values);
        $field->addDepartments($_POST['fld_departments']);
        if ($hField->insert($field)) {
            _clearEditSessionVars($fld_id);
            redirect_header(xhelpMakeURI(XHELP_ADMIN_URL . '/fields.php'), 3, _AM_XHELP_MSG_FIELD_UPD_OK);
        } else {
            redirect_header(xhelpMakeURI(XHELP_ADMIN_URL . '/fields.php', array('op' => 'editfield', 'id' => $fld_id), false), 3, _AM_XHELP_MSG_FIELD_UPD_ERR);
        }
    }
}
예제 #16
0
/**
* News export
*
* You can use this function in the module's admin when you click on the tab named "News Export"
* First select a range of date, possibly a range of topics and if you want, check the option "Include Topics Definitions"
* to also export the topics.
* News, and topics, will be exported to the XML format.
*/
function NewsExport()
{
    global $xoopsDB;
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    xoops_cp_header();
    adminmenu(4);
    echo "<br />";
    $sform = new XoopsThemeForm(_AM_NEWS_EXPORT_NEWS, "exportform", XOOPS_URL . '/modules/news/admin/index.php', 'post');
    $dates_tray = new XoopsFormElementTray(_AM_NEWS_EXPORT_BETWEEN);
    $date1 = new XoopsFormTextDateSelect('', 'date1', 15, time());
    $date2 = new XoopsFormTextDateSelect(_AM_NEWS_EXPORT_AND, 'date2', 15, time());
    $dates_tray->addElement($date1);
    $dates_tray->addElement($date2);
    $sform->addElement($dates_tray);
    $topiclist = new XoopsFormSelect(_AM_NEWS_PRUNE_TOPICS, 'export_topics', '', 5, true);
    $topics_arr = array();
    $xt = new NewsTopic();
    $allTopics = $xt->getAllTopics(false);
    // The webmaster can see everything
    $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
    $topics_arr = $topic_tree->getAllChild(0);
    if (count($topics_arr)) {
        foreach ($topics_arr as $onetopic) {
            $topiclist->addOption($onetopic->topic_id(), $onetopic->topic_title());
        }
    }
    $topiclist->setDescription(_AM_NEWS_EXPORT_PRUNE_DSC);
    $sform->addElement($topiclist, false);
    $sform->addElement(new XoopsFormRadioYN(_AM_NEWS_EXPORT_INCTOPICS, 'includetopics', 0), false);
    $sform->addElement(new XoopsFormHidden('op', 'launchexport'), false);
    $button_tray = new XoopsFormElementTray('', '');
    $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit');
    $button_tray->addElement($submit_btn);
    $sform->addElement($button_tray);
    $sform->display();
}
예제 #17
0
 /**
  * Returns a {@link XoopsFormElement} for editing the value of this field
  *
  * @param object $user {@link XoopsUser} object to edit the value of
  *
  * @return object
  **/
 function getEditElement(&$user)
 {
     $value = $user->getVar($this->getVar('field_name'), 'e');
     $caption = $this->getVar('field_title');
     $caption = defined($caption) ? constant($caption) : $caption;
     $name = $this->getVar('field_name', 'e');
     $options = $this->getVar('field_options');
     asort($options);
     foreach (array_keys($options) as $key) {
         $optval = defined($options[$key]) ? constant($options[$key]) : $options[$key];
         $optkey = defined($key) ? constant($key) : $key;
         unset($options[$key]);
         $options[$optkey] = $optval;
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     switch ($this->getVar('field_type')) {
         default:
         case "autotext":
             //autotext is not for editing
             $element = new XoopsFormLabel($caption, $this->getOutputValue($user));
             break;
         case "textbox":
             $element = new XoopsFormText($caption, $name, 35, $this->getVar('field_maxlength'), $value);
             break;
         case "textarea":
             $element = new XoopsFormTextArea($caption, $name, $value, 10, 50);
             break;
         case "dhtml":
             $element = new XoopsFormDhtmlTextArea($caption, $name, $value, 10, 50);
             break;
         case "select":
             $element = new XoopsFormSelect($caption, $name, $value);
             $element->addOptionArray($options);
             break;
         case "select_multi":
             $element = new XoopsFormSelect($caption, $name, $value, 5, true);
             $element->addOptionArray($options);
             break;
         case "radio":
             $element = new XoopsFormRadio($caption, $name, $value);
             $element->addOptionArray($options);
             break;
         case "checkbox":
             $element = new XoopsFormCheckBox($caption, $name, $value);
             $element->addOptionArray($options);
             break;
         case "yesno":
             $element = new XoopsFormRadioYN($caption, $name, $value);
             break;
         case "group":
             $element = new XoopsFormSelectGroup($caption, $name, true, $value);
             break;
         case "group_multi":
             $element = new XoopsFormSelectGroup($caption, $name, true, $value, 5, true);
             break;
         case "language":
             $element = new XoopsFormSelectLang($caption, $name, $value);
             break;
         case "date":
             $element = new XoopsFormTextDateSelect($caption, $name, 15, $value);
             break;
             //            case "longdate":
             //            $element = new XoopsFormTextDateSelect($caption, $name, 15, str_replace("-", "/", $value));
             //            break;
         //            case "longdate":
         //            $element = new XoopsFormTextDateSelect($caption, $name, 15, str_replace("-", "/", $value));
         //            break;
         case "datetime":
             $element = new XoopsFormDatetime($caption, $name, 15, $value);
             break;
         case "list":
             $element = new XoopsFormSelectList($caption, $name, $value, 1, $options[0]);
             break;
         case "timezone":
             $element = new XoopsFormSelectTimezone($caption, $name, $value);
             break;
         case 'theme':
             $element = new XoopsFormSelect($caption, $name, $value);
             $element->addOption("0", _SITEDEFAULT);
             $theme_list = XoopsLists::getThemesList();
             foreach ($theme_list as $key => $val) {
                 if (!in_array($key, $GLOBALS['xoopsConfig']['theme_set_allowed'])) {
                     continue;
                 }
                 $element->addOption($key, $val);
             }
             /*
             $handle = opendir(XOOPS_THEME_PATH.'/');
             $dirlist = array();
             while (false !== ($file = readdir($handle))) {
                 if (is_dir(XOOPS_THEME_PATH.'/'.$file) && !preg_match("/^[.]{1,2}$/",$file) && strtolower($file) != 'cvs') {
                     if (file_exists(XOOPS_THEME_PATH."/".$file."/theme.html") && in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'])) {
                         $dirlist[$file]=$file;
                     }
                 }
             }
             closedir($handle);
             if (!empty($dirlist)) {
                 asort($dirlist);
                 $element->addOptionArray($dirlist);
             }
             */
             break;
     }
     if ($this->getVar('field_description') != "") {
         $element->setDescription($this->getVar('field_description'));
     }
     return $element;
 }
예제 #18
0
 function createPermissionControls()
 {
     $smartModuleConfig = $this->targetObject->handler->getModuleConfig();
     $permissions = $this->targetObject->handler->getPermissions();
     if ($permissions) {
         $member_handler =& xoops_gethandler('member');
         $group_list = $member_handler->getGroupList();
         asort($group_list);
         foreach ($permissions as $permission) {
             if ($this->targetObject->isNew()) {
                 if (isset($smartModuleConfig['def_perm_' . $permission['perm_name']])) {
                     $groups_value = $smartModuleConfig['def_perm_' . $permission['perm_name']];
                 }
             } else {
                 $groups_value = $this->targetObject->getGroupPerm($permission['perm_name']);
             }
             $groups_select = new XoopsFormSelect($permission['caption'], $permission['perm_name'], $groups_value, 4, true);
             $groups_select->setDescription($permission['description']);
             $groups_select->addOptionArray($group_list);
             $this->addElement($groups_select);
             unset($groups_select);
         }
     }
 }
예제 #19
0
 /**
  * Returns a {@link XoopsFormElement} for editing the value of this field
  *
  * @param XoopsUser $user {@link XoopsUser} object to edit the value of
  * @param ProfileProfile $profile {@link ProfileProfile} object to edit the value of
  *
  * @return XoopsFormElement
  **/
 function getEditElement($user, $profile)
 {
     $value = in_array($this->getVar('field_name'), $this->getUserVars()) ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e');
     $caption = $this->getVar('field_title');
     $caption = defined($caption) ? constant($caption) : $caption;
     $name = $this->getVar('field_name', 'e');
     $options = $this->getVar('field_options');
     if (is_array($options)) {
         //asort($options);
         foreach (array_keys($options) as $key) {
             $optval = defined($options[$key]) ? constant($options[$key]) : $options[$key];
             $optkey = defined($key) ? constant($key) : $key;
             unset($options[$key]);
             $options[$optkey] = $optval;
         }
     }
     include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
     switch ($this->getVar('field_type')) {
         default:
         case "autotext":
             //autotext is not for editing
             $element = new XoopsFormLabel($caption, $this->getOutputValue($user, $profile));
             break;
         case "textbox":
             $element = new XoopsFormText($caption, $name, 35, $this->getVar('field_maxlength'), $value);
             break;
         case "textarea":
             $element = new XoopsFormTextArea($caption, $name, $value, 4, 30);
             break;
         case "dhtml":
             $element = new XoopsFormDhtmlTextArea($caption, $name, $value, 10, 30);
             break;
         case "select":
             $element = new XoopsFormSelect($caption, $name, $value);
             // If options do not include an empty element, then add a blank option to prevent any default selection
             if (!in_array('', array_keys($options))) {
                 $element->addOption('', _NONE);
                 $eltmsg = empty($caption) ? sprintf(_FORM_ENTER, $name) : sprintf(_FORM_ENTER, $caption);
                 $eltmsg = str_replace('"', '\\"', stripslashes($eltmsg));
                 $element->customValidationCode[] = "\nvar hasSelected = false; var selectBox = myform.{$name};" . "for (i = 0; i < selectBox.options.length; i++  ) { if ( selectBox.options[i].selected == true && selectBox.options[i].value != '' ) { hasSelected = true; break; } }" . "if ( !hasSelected ) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }";
             }
             $element->addOptionArray($options);
             break;
         case "select_multi":
             $element = new XoopsFormSelect($caption, $name, $value, 5, true);
             $element->addOptionArray($options);
             break;
         case "radio":
             $element = new XoopsFormRadio($caption, $name, $value);
             $element->addOptionArray($options);
             break;
         case "checkbox":
             $element = new XoopsFormCheckBox($caption, $name, $value);
             $element->addOptionArray($options);
             break;
         case "yesno":
             $element = new XoopsFormRadioYN($caption, $name, $value);
             break;
         case "group":
             $element = new XoopsFormSelectGroup($caption, $name, true, $value);
             break;
         case "group_multi":
             $element = new XoopsFormSelectGroup($caption, $name, true, $value, 5, true);
             break;
         case "language":
             $element = new XoopsFormSelectLang($caption, $name, $value);
             break;
         case "date":
             $element = new XoopsFormTextDateSelect($caption, $name, 15, $value);
             break;
         case "longdate":
             $element = new XoopsFormTextDateSelect($caption, $name, 15, str_replace("-", "/", $value));
             break;
         case "datetime":
             $element = new XoopsFormDatetime($caption, $name, 15, $value);
             break;
         case "list":
             $element = new XoopsFormSelectList($caption, $name, $value, 1, $options[0]);
             break;
         case "timezone":
             $element = new XoopsFormSelectTimezone($caption, $name, $value);
             $element->setExtra("style='width: 280px;'");
             break;
         case "rank":
             $element = new XoopsFormSelect($caption, $name, $value);
             include_once $GLOBALS['xoops']->path('class/xoopslists.php');
             $ranks = XoopsLists::getUserRankList();
             $element->addOption(0, "--------------");
             $element->addOptionArray($ranks);
             break;
         case 'theme':
             $element = new XoopsFormSelect($caption, $name, $value);
             $element->addOption("0", _PROFILE_MA_SITEDEFAULT);
             $handle = opendir(XOOPS_THEME_PATH . '/');
             $dirlist = array();
             while (false !== ($file = readdir($handle))) {
                 if (is_dir(XOOPS_THEME_PATH . '/' . $file) && !preg_match("/^[.]{1,2}\$/", $file) && strtolower($file) != 'cvs') {
                     if (file_exists(XOOPS_THEME_PATH . "/" . $file . "/theme.html") && in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'])) {
                         $dirlist[$file] = $file;
                     }
                 }
             }
             closedir($handle);
             if (!empty($dirlist)) {
                 asort($dirlist);
                 $element->addOptionArray($dirlist);
             }
             break;
     }
     if ($this->getVar('field_description') != "") {
         $element->setDescription($this->getVar('field_description'));
     }
     return $element;
 }
예제 #20
0
// Define scripts
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
$xoTheme->addScript('browse.php?modules/system/js/admin.js');
switch ($op) {
    case 'list':
    default:
        // Define Breadcrumb and tips
        $xoBreadCrumb->addLink(_AM_SYSTEM_MAINTENANCE_NAV_MANAGER, system_adminVersion('maintenance', 'adminpath'));
        $xoBreadCrumb->addHelp(system_adminVersion('maintenance', 'help'));
        $xoBreadCrumb->addTips(_AM_SYSTEM_MAINTENANCE_TIPS);
        $xoBreadCrumb->render();
        $maintenance = new SystemMaintenance();
        //Form Maintenance
        $form_maintenance = new XoopsThemeForm(_AM_SYSTEM_MAINTENANCE, "maintenance_save", "admin.php?fct=maintenance", 'post', true);
        $cache = new XoopsFormSelect(_AM_SYSTEM_MAINTENANCE_CACHE, "cache", '', 3, true);
        $cache->setDescription(XOOPS_VAR_PATH . "/cache/smarty_cache/<br />" . XOOPS_VAR_PATH . "/cache/smarty_compile/<br />" . XOOPS_VAR_PATH . "/cache/xoops_cache/");
        $cache_arr = array(1 => 'smarty_cache', 2 => 'smarty_compile', 3 => 'xoops_cache');
        $cache->addOptionArray($cache_arr);
        $form_maintenance->addElement($cache);
        $form_maintenance->addElement(new XoopsFormRadioYN(_AM_SYSTEM_MAINTENANCE_SESSION, 'session', '', _YES, _NO));
        $tables_tray = new XoopsFormElementTray(_AM_SYSTEM_MAINTENANCE_TABLES, '');
        $tables_tray->setDescription(_AM_SYSTEM_MAINTENANCE_TABLES_DESC);
        $select_tables = new XoopsFormSelect('', "tables", '', 7, true);
        $select_tables->addOptionArray($maintenance->displayTables(true));
        $tables_tray->addElement($select_tables, false);
        $tables_tray->addElement(new xoopsFormLabel('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . _AM_SYSTEM_MAINTENANCE_DUMP_AND . '&nbsp;'));
        $choice = new XoopsFormSelect('&nbsp;&nbsp;', "maintenance", '', 4, true);
        $options = array('1' => _AM_SYSTEM_MAINTENANCE_CHOICE1, '2' => _AM_SYSTEM_MAINTENANCE_CHOICE2, '3' => _AM_SYSTEM_MAINTENANCE_CHOICE3, '4' => _AM_SYSTEM_MAINTENANCE_CHOICE4);
        $choice->addOptionArray($options);
        $tables_tray->addElement($choice, false);
        $form_maintenance->addElement($tables_tray);
예제 #21
0
파일: products.php 프로젝트: osw17/oledrion
 $manufacturers = $h_oledrion_manufacturer->getObjects($criteria);
 foreach ($manufacturers as $oneitem) {
     $manufacturers_d[$oneitem->getVar('manu_id')] = xoops_trim($oneitem->getVar('manu_name')) . ' ' . xoops_trim($oneitem->getVar('manu_commercialname'));
 }
 // Recherche des fabricants de ce produit
 if ($edit) {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('pm_product_id', $item->getVar('product_id'), '='));
     $productsManufacturers = $h_oledrion_productsmanu->getObjects($criteria);
     foreach ($productsManufacturers as $oneproduct) {
         $productsManufacturers_d[] = $oneproduct->getVar('pm_manu_id');
     }
 }
 $manufacturersSelect = new XoopsFormSelect(_OLEDRION_MANUFACTURER, 'manufacturers', $productsManufacturers_d, 5, true);
 $manufacturersSelect->addOptionArray($manufacturers_d);
 $manufacturersSelect->setDescription(_AM_OLEDRION_SELECT_HLP);
 $sform->addElement($manufacturersSelect, true);
 // Produits relatifs ****************************************************
 $relatedProducts = $productRelated = $relatedProducts_d = $productRelated_d = array();
 // Recherche de tous les produits sauf celui-là
 $criteria = new Criteria('product_id', $item->getVar('product_id'), '<>');
 $criteria->setSort('product_title');
 $relatedProducts = $h_oledrion_products->getObjects($criteria);
 foreach ($relatedProducts as $oneitem) {
     $relatedProducts_d[$oneitem->getVar('product_id')] = xoops_trim($oneitem->getVar('product_title'));
 }
 // Recherche des produits relatifs à ce produit
 if ($edit) {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('related_product_id', $item->getVar('product_id'), '='));
     $productRelated = $h_oledrion_related->getObjects($criteria);
예제 #22
0
 /**
  * Construit un sélecteur de produit(s) en fonction des paramètres et en tenant compte du nombre total de produits dans la base
  *
  * @todo: Remplacer les paramètres par un objet paramètre et/ou un tableau
  * @param  string  $caption     Le titre du sélecteur
  * @param  string  $name        Le nom du champ qui receuille les produits
  * @param  mixed   $value       La valeur sélectionnées
  * @param  integer $size        Le nombre d'éléments visibles dans le sélecteur
  * @param  boolean $multiple    Indique si c'est un sélecteur multiple ou pas
  * @param  array   $values      Les valeurs sélectionnées ou les valeurs qui font le sélecteur
  * @param  boolean $showAll     Indique s'il faut voir tous les produits ou pas (pas publiés et en stock)
  * @param  string  $sort        Zone de tri
  * @param  string  $order       Ordre de tri
  * @param  string  $formName    Nom du formulaire
  * @param  string  $description Description à rajouter à la zone
  * @param  mixed   $withNull    Option à rajouter en premier
  * @return object  Retourne soit un objet de type tray {@link XoopsFormElementTray} soit un select {@link XoopsFormSelect}
  */
 public function productSelector(oledrion_parameters $parameters)
 {
     $parameters = $parameters->extend(new oledrion_parameters(array('caption' => '', 'name' => '', 'value' => null, 'size' => 1, 'multiple' => false, 'values' => null, 'showAll' => true, 'sort' => 'product_title', 'order' => 'ASC', 'formName' => '', 'description' => '', 'withNull' => null)));
     static $jqueryIncluded = null;
     require_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('product_id', 0, '<>'));
     if (!$parameters['showAll']) {
         if (oledrion_utils::getModuleOption('show_unpublished') == 0) {
             // Ne pas afficher les produits qui ne sont pas publiés
             $criteria->add(new Criteria('product_submitted', time(), '<='));
         }
         if (oledrion_utils::getModuleOption('nostock_display') == 0) {
             // Se limiter aux seuls produits encore en stock
             $criteria->add(new Criteria('product_stock', 0, '>'));
         }
     }
     $criteria->setSort($parameters['sort']);
     $criteria->setOrder($parameters['order']);
     $itemsCount = $this->getCount($criteria);
     if ($itemsCount > oledrion_utils::getModuleOption('max_products')) {
         // Il faut créer notre propre sélecteur
         if ($parameters['multiple']) {
             if ($jqueryIncluded == null) {
                 $jqueryIncluded = true;
                 global $xoTheme;
                 $xoTheme->addScript("browse.php?Frameworks/jquery/jquery.js");
             }
             oledrion_utils::callJavascriptFile('select/select.js', false, true);
             $productTray = new XoopsFormElementTray($parameters['caption'], '');
             $productsList = new XoopsFormSelect('', $parameters['name'], $parameters['values'], $parameters['size'], $parameters['multiple']);
             // Recherche des produits
             $selectedProducts = $this->getList(new Criteria('product_id', '(' . implode(',', $parameters['values']) . ')', 'IN'));
             $productsList->addOptionArray($selectedProducts);
             // Les valeurs sélectionnées
             $productTray->addElement($productsList);
             $removeButton = new XoopsFormButton('', 'removeProduct', _AM_OLEDRION_REMOVE_SELECTED, 'button');
             if (oledrion_utils::isX20()) {
                 $removeButton->setExtra(" onclick=\"removeOptionSelected('" . $parameters['name'] . "[]');\"");
             } else {
                 $removeButton->setExtra(" onclick=\"removeOptionSelected('" . $parameters['name'] . "');\"");
             }
             $productTray->addElement($removeButton);
             if (oledrion_utils::isX20()) {
                 $link = "<a href=\"javascript:openWithSelfMain('" . OLEDRION_ADMIN_URL . "productsselector.php?mutipleSelect=1&amp;callerName=" . $parameters['name'] . "[]', '', " . OLEDRION_MAX_PRODUCTS_POPUP_WIDTH . ", " . OLEDRION_MAX_PRODUCTS_POPUP_HEIGHT . ");\">" . _AM_OLEDRION_SELECT_OTHER_P . "</a>";
             } else {
                 $link = "<a href=\"javascript:openWithSelfMain('" . OLEDRION_ADMIN_URL . "productsselector.php?mutipleSelect=1&amp;callerName=" . $parameters['name'] . "', '', " . OLEDRION_MAX_PRODUCTS_POPUP_WIDTH . ", " . OLEDRION_MAX_PRODUCTS_POPUP_HEIGHT . ");\">" . _AM_OLEDRION_SELECT_OTHER_P . "</a>";
             }
             $linkLabel = new xoopsFormLabel('', '<br />' . $link);
             $productTray->addElement($linkLabel);
             echo "<script type=\"text/javascript\">\n";
             echo "jQuery().ready(function(\$) {\n";
             echo "\$(\"#" . $parameters['formName'] . "\").submit( function() {\n";
             echo "\tselectAll('" . $parameters['name'] . "', true);\n";
             echo "} );\n";
             echo "});\n";
             echo "</script>\n";
         } else {
             // Pas de sélection multiple
             $productTray = new XoopsFormElementTray($parameters['caption'], '');
             $productsList = new XoopsFormSelect('', $parameters['name'], $parameters['value'], $parameters['size'], $parameters['multiple']);
             // Recherche des produits
             if ($parameters['value'] > 0) {
                 $selectedProducts = $this->getList(new Criteria('product_id', $parameters['value'], '='));
                 if (!is_null($parameters['withNull'])) {
                     $selectedProducts[0] = $parameters['withNull'];
                     ksort($selectedProducts);
                 }
                 $productsList->addOptionArray($selectedProducts);
                 // Les valeurs sélectionnées
             }
             $productTray->addElement($productsList);
             $link = "<a href=\"javascript:openWithSelfMain('" . OLEDRION_ADMIN_URL . "productsselector.php?mutipleSelect=0&amp;callerName=" . $parameters['name'] . "', '', " . OLEDRION_MAX_PRODUCTS_POPUP_WIDTH . ", " . OLEDRION_MAX_PRODUCTS_POPUP_HEIGHT . ");\">" . _AM_OLEDRION_SELECT_PRODUCT . "</a>";
             $linkLabel = new xoopsFormLabel('', '<br />' . $link);
             $productTray->addElement($linkLabel);
         }
     } else {
         $productTray = new XoopsFormSelect($parameters['caption'], $parameters['name'], $parameters['value'], $parameters['size'], $parameters['multiple']);
         $products = $this->getList($criteria);
         $productTray->addOptionArray($products);
     }
     if (trim($parameters['description']) != '') {
         $productTray->setDescription($parameters['description']);
     }
     return $productTray;
 }
예제 #23
0
function edititem($showmenu = false, $itemid = 0)
{
    global $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a item
    if ($itemid != 0) {
        // Creating the ITEM object
        $itemObj = new ssItem($itemid);
        if ($itemObj->notLoaded()) {
            redirect_header("item.php", 1, _AM_SS_NOITEMSELECTED);
            exit;
        }
        switch ($itemObj->status()) {
            case _SS_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SS_SUBMITTED;
                $breadcrumb_action2 = _AM_SS_APPROVING;
                $page_title = _AM_SS_SUBMITTED_TITLE;
                $page_info = _AM_SS_SUBMITTED_INFO;
                $button_caption = _AM_SS_APPROVE;
                $new_status = _SS_STATUS_PUBLISHED;
                break;
            case _SS_STATUS_PUBLISHED:
                $breadcrumb_action1 = _AM_SS_PUBLISHED;
                $breadcrumb_action2 = _AM_SS_EDITING;
                $page_title = _AM_SS_PUBLISHEDEDITING;
                $page_info = _AM_SS_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SS_MODIFY;
                $new_status = _SS_STATUS_PUBLISHED;
                break;
            case _SS_STATUS_OFFLINE:
                $breadcrumb_action1 = _AM_SS_OFFLINE;
                $breadcrumb_action2 = _AM_SS_EDITING;
                $page_title = _AM_SS_OFFLINEEDITING;
                $page_info = _AM_SS_OFFLINEEDITING_INFO;
                $button_caption = _AM_SS_MODIFY;
                $new_status = _SS_STATUS_OFFLINE;
                break;
            case "default":
            default:
                break;
        }
        $categoryObj =& $itemObj->category();
        if ($showmenu) {
            ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        ss_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info);
    } else {
        // there's no parameter, so we're adding an item
        $itemObj =& $smartsection_item_handler->create();
        $categoryObj =& $smartsection_category_handler->create();
        $breadcrumb_action1 = _AM_SS_ITEMS;
        $breadcrumb_action2 = _AM_SS_CREATINGNEW;
        $button_caption = _AM_SS_CREATE;
        $new_status = _SS_STATUS_PUBLISHED;
        if ($showmenu) {
            ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0;
        $categoryObj->setVar('categoryid', $sel_categoryid);
        ss_collapsableBar('createitemtable', 'createitemicon', _AM_SS_ITEM_CREATING, _AM_SS_ITEM_CREATING_DSC);
    }
    // ITEM FORM
    $sform = new XoopsThemeForm(_AM_SS_ITEMS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // CATEGORY
    $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
    ob_start();
    $sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid()));
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $category_label = new XoopsFormLabel(_AM_SS_CATEGORY, ob_get_contents());
    $category_label->setDescription(_AM_SS_CATEGORY_DSC);
    $sform->addElement($category_label);
    ob_end_clean();
    // TITLE
    $title_text = new XoopsFormText(_AM_SS_TITLE, 'title', 50, 255, $itemObj->title(0, 'e'));
    $sform->addElement($title_text, true);
    // SUMMARY
    $summary_text = ss_getEditor(_AM_SS_SUMMARY, 'summary', $itemObj->summary(0, 'e'));
    $summary_text->setDescription(_AM_SS_SUMMARY_DSC);
    $sform->addElement($summary_text, false);
    // DISPLAY_SUMMARY
    $display_summary_radio = new XoopsFormRadioYN(_AM_SS_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . '');
    $sform->addElement($display_summary_radio);
    // BODY
    $body_text = ss_getEditor(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'));
    //$body_text = new XoopsFormDhtmlTextArea(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'), 20, 60);
    $body_text->setDescription(_AM_SS_BODY_DSC);
    $sform->addElement($body_text, true);
    // IMAGE
    $image_array =& XoopsLists::getImgListAsArray(ss_getImageDir('item'));
    $image_select = new XoopsFormSelect('', 'image', $itemObj->image());
    //$image_select -> addOption ('-1', '---------------');
    $image_select->addOptionArray($image_array);
    $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $image_tray = new XoopsFormElementTray(_AM_SS_IMAGE_ITEM, '&nbsp;');
    $image_tray->addElement($image_select);
    $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . ss_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />"));
    $image_tray->setDescription(_AM_SS_IMAGE_ITEM_DSC);
    $sform->addElement($image_tray);
    // IMAGE UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SS_IMAGE_UPLOAD, "image_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(_AM_SS_IMAGE_UPLOAD_ITEM_DSC);
    $sform->addElement($file_box);
    // Uid
    /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
    	    the method users::getobjects encounters a memory error 
    	*/
    $uid = $itemObj->uid() == 0 ? $xoopsUser->uid() : $itemObj->uid();
    $uid_select = new XoopsFormSelect(_AM_SS_UID, 'uid', $uid, 1, false);
    $uid_select->setDescription(_AM_SS_UID_DSC);
    $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC";
    $result = $xoopsDB->query($sql);
    $users_array = array();
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $users_array[$myrow['uid']] = $myrow['uname'];
    }
    $uid_select->addOptionArray($users_array);
    $sform->addElement($uid_select);
    // Datesub
    $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub');
    $datesub_datetime = new XoopsFormDateTime(_AM_SS_DATESUB, 'datesub', $size = 15, $datesub);
    $datesub_datetime->setDescription(_AM_SS_DATESUB_DSC);
    $sform->addElement($datesub_datetime);
    // STATUS
    $options = array(_SS_STATUS_PUBLISHED => _AM_SS_PUBLISHED, _SS_STATUS_OFFLINE => _AM_SS_OFFLINE);
    $status_select = new XoopsFormSelect(_AM_SS_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SS_STATUS_DSC);
    $sform->addElement($status_select);
    // WEIGHT
    $sform->addElement(new XoopsFormText(_AM_SS_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true);
    // COMMENTS
    $addcomments_radio = new XoopsFormRadioYN(_AM_SS_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . '');
    $sform->addElement($addcomments_radio);
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read());
    $groups_checkbox->setDescription(_AM_SS_PERMISSIONS_ITEM_DSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_checkbox);
    // VARIOUS OPTIONS
    $options_tray = new XoopsFormElementTray(_AM_SS_OPTIONS, '<br />');
    $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml());
    $html_checkbox->addOption(1, _AM_SS_DOHTML);
    $options_tray->addElement($html_checkbox);
    $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley());
    $smiley_checkbox->addOption(1, _AM_SS_DOSMILEY);
    $options_tray->addElement($smiley_checkbox);
    $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode());
    $xcodes_checkbox->addOption(1, _AM_SS_DOXCODE);
    $options_tray->addElement($xcodes_checkbox);
    $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage());
    $images_checkbox->addOption(1, _AM_SS_DOIMAGE);
    $options_tray->addElement($images_checkbox);
    $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr());
    $linebreak_checkbox->addOption(1, _AM_SS_DOLINEBREAK);
    $options_tray->addElement($linebreak_checkbox);
    $sform->addElement($options_tray);
    // item ID
    $sform->addElement(new XoopsFormHidden('itemid', $itemObj->itemid()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'additem');
    $button_tray->addElement($hidden);
    if (!$itemid) {
        // there's no itemid? Then it's a new item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SS_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SS_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        ss_close_collapsable('createitemtable', 'createitemicon');
    } else {
        // else, we're editing an existing item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        ss_close_collapsable('edititemtable', 'edititemicon');
    }
    unset($hidden);
    if ($itemid != 0) {
        showfiles($itemObj);
    }
}
예제 #24
0
function send_form()
{
    global $xoopsModuleConfig;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    $this_handler =& xoops_getModuleHandler('user', 'subscribers');
    $form = new XoopsThemeForm(_AM_SUBSCRIBERS_SEND, 'send_form', 'admin_send.php', "post");
    $element = new XoopsFormLabel(_MI_SUBSCRIBERS_CONF_FROMNAME, $xoopsModuleConfig['fromname']);
    $form->addElement($element);
    unset($element);
    $element = new XoopsFormLabel(_MI_SUBSCRIBERS_CONF_FROMEMAIL, $xoopsModuleConfig['fromemail']);
    $form->addElement($element);
    unset($element);
    // Country
    include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
    $countries = array("ALL" => _AM_SUBSCRIBERS_ALL_COUNTRIES);
    $countries2 = XoopsLists::getCountryList();
    array_shift($countries2);
    $countries += $countries2;
    $element = new XoopsFormSelect(_AM_SUBSCRIBERS_COUNTRY, 'country', 'ALL');
    $element->addOptionArray($countries);
    $form->addElement($element);
    unset($element, $countries);
    // Subject
    $form->addElement(new XoopsFormText(_AM_SUBSCRIBERS_EMAIL_SUBJECT, 'subject', 75, 150, ''), true);
    // Body
    $editor_configs = array();
    $editor_configs['rows'] = 35;
    $editor_configs['cols'] = 60;
    $editor_configs['width'] = '100%';
    $editor_configs['height'] = '400px';
    $editor_configs['name'] = 'body';
    $editor_configs['value'] = '';
    $element = new XoopsFormEditor(_AM_SUBSCRIBERS_EMAIL_BODY, $xoopsModuleConfig['editor'], $editor_configs, $nohtml = false, $onfailure = null);
    $element->setDescription(_AM_SUBSCRIBERS_EMAIL_BODY_DSC);
    $form->addElement($element);
    unset($element);
    // Priority
    $priorities = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    unset($priorities[0]);
    $element = new XoopsFormSelect(_AM_SUBSCRIBERS_EMAIL_PRIORITY, 'priority', 5);
    $element->setDescription(_AM_SUBSCRIBERS_EMAIL_PRIORITY_DSC);
    $element->addOptionArray($priorities);
    $form->addElement($element);
    unset($element, $priorities);
    // Groups
    $groups = array(_AM_SUBSCRIBERS_SUBSCRIBERS, _AM_SUBSCRIBERS_USERS, _AM_SUBSCRIBERS_BOTH);
    $element = new XoopsFormSelect(_AM_SUBSCRIBERS_EMAIL_GROUPS, 'groups', 0);
    $element->setDescription(_AM_SUBSCRIBERS_EMAIL_GROUPS_DSC);
    $element->addOptionArray($groups);
    $form->addElement($element);
    unset($element, $groups);
    // Buttons
    $tray = new XoopsFormElementTray('', '');
    $tray->addElement(new XoopsFormButton('', 'submit_button', _SUBMIT, 'submit'));
    $btn = new XoopsFormButton('', 'reset', _CANCEL, 'button');
    $btn->setExtra('onclick="document.location.href=\'admin_send.php\'"');
    $tray->addElement($btn);
    $form->addElement($tray);
    $form->addElement(new XoopsFormHidden('op', 'email'));
    return $form->render();
}
예제 #25
0
function editpartner($showmenu = false, $id = 0)
{
    global $xoopsDB, $smartpartner_partner_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    if (!isset($smartpartner_partner_handler)) {
        $smartpartner_partner_handler =& smartpartner_gethandler('partner');
    }
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a partner
    if ($id != 0) {
        // Creating the partner object
        $partnerObj = new SmartpartnerPartner($id);
        if ($partnerObj->notLoaded()) {
            redirect_header("partner.php", 1, _AM_SPARTNER_NOPARTNERSELECTED);
            exit;
        }
        switch ($partnerObj->status()) {
            case _SPARTNER_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SPARTNER_SUBMITTED_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_APPROVING;
                $page_title = _AM_SPARTNER_SUBMITTED_TITLE;
                $page_info = _AM_SPARTNER_SUBMITTED_INFO;
                $button_caption = _AM_SPARTNER_APPROVE;
                $new_status = _SPARTNER_STATUS_ACTIVE;
                break;
            case _SPARTNER_STATUS_ACTIVE:
                $breadcrumb_action1 = _AM_SPARTNER_ACTIVE_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_ACTIVE_EDITING;
                $page_info = _AM_SPARTNER_ACTIVE_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_ACTIVE;
                break;
            case _SPARTNER_STATUS_INACTIVE:
                $breadcrumb_action1 = _AM_SPARTNER_INACTIVE_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_INACTIVE_EDITING;
                $page_info = _AM_SPARTNER_INACTIVE_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_INACTIVE;
                break;
            case _SPARTNER_STATUS_REJECTED:
                $breadcrumb_action1 = _AM_SPARTNER_REJECTED_PARTNERS;
                $breadcrumb_action2 = _AM_SPARTNER_EDITING;
                $page_title = _AM_SPARTNER_REJECTED_EDITING;
                $page_info = _AM_SPARTNER_REJECTED_EDITING_INFO;
                $button_caption = _AM_SPARTNER_MODIFY;
                $new_status = _SPARTNER_STATUS_REJECTED;
                break;
            case "default":
            default:
                break;
        }
        if ($showmenu) {
            smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        smartpartner_collapsableBar('editpartner', 'editpartmericon', $page_title, $page_info);
    } else {
        // there's no parameter, so we're adding a partner
        $partnerObj =& $smartpartner_partner_handler->create();
        $breadcrumb_action1 = _AM_SPARTNER_PARTNERS;
        $breadcrumb_action2 = _AM_SPARTNER_CREATE;
        $button_caption = _AM_SPARTNER_CREATE;
        $new_status = _SPARTNER_STATUS_ACTIVE;
        if ($showmenu) {
            smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        smartpartner_collapsableBar('addpartner', 'addpartmericon', _AM_SPARTNER_PARTNER_CREATING, _AM_SPARTNER_PARTNER_CREATING_DSC);
    }
    // PARTNER FORM
    $sform = new XoopsThemeForm(_AM_SPARTNER_PARTNERS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // TITLE
    $title_text = new XoopsFormText(_AM_SPARTNER_TITLE, 'title', 50, 255, $partnerObj->title('e'));
    $sform->addElement($title_text, true);
    // Parent Category
    $mytree = new SmartTree($xoopsDB->prefix("smartpartner_categories"), "categoryid", "parentid");
    ob_start();
    $mytree->makeMySelBox("name", "weight", explode('|', $partnerObj->categoryid()), 0, 'categoryid', '', true);
    //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
    $parent_cat_select = new XoopsFormLabel(_AM_SPARTNER_CATEGORY_BELONG, ob_get_contents());
    $parent_cat_select->setDescription(_AM_SPARTNER_BELONG_CATEGORY_DSC);
    $sform->addElement($parent_cat_select);
    ob_end_clean();
    // LOGO
    $logo_array =& XoopsLists::getImgListAsArray(smartpartner_getImageDir());
    $logo_select = new XoopsFormSelect('', 'image', $partnerObj->image());
    $logo_select->addOption('-1', '---------------');
    $logo_select->addOptionArray($logo_array);
    $logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTPARTNER_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $logo_tray = new XoopsFormElementTray(_AM_SPARTNER_LOGO, '&nbsp;');
    $logo_tray->addElement($logo_select);
    $logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartpartner_getImageDir('', false) . $partnerObj->image() . "' name='image3' id='image3' alt='' />"));
    $logo_tray->setDescription(_AM_SPARTNER_LOGO_DSC);
    $sform->addElement($logo_tray);
    // LOGO UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SPARTNER_LOGO_UPLOAD, "logo_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(sprintf(_AM_SPARTNER_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height']));
    $sform->addElement($file_box);
    // IMAGE_URL
    $image_url_text = new XoopsFormText(_CO_SPARTNER_IMAGE_URL, 'image_url', 50, 255, $partnerObj->image_url());
    $image_url_text->setDescription(_CO_SPARTNER_IMAGE_URL_DSC);
    $sform->addElement($image_url_text, false);
    // URL
    $url_text = new XoopsFormText(_AM_SPARTNER_URL, 'url', 50, 255, $partnerObj->url());
    $url_text->setDescription(_AM_SPARTNER_URL_DSC);
    $sform->addElement($url_text, false);
    // SUMMARY
    $summary_text = new XoopsFormTextArea(_AM_SPARTNER_SUMMARY, 'summary', $partnerObj->summary(0, 'e'), 7, 60);
    $summary_text->setDescription(_AM_SPARTNER_SUMMARY_DSC);
    $sform->addElement($summary_text, true);
    // SHOW summary on partner page
    $showsum_radio = new XoopsFormRadioYN(_AM_SPARTNER_SHOW_SUMMARY, 'showsummary', $partnerObj->getVar('showsummary'));
    $showsum_radio->setDescription(_AM_SPARTNER_SHOW_SUMMARY_DSC);
    $sform->addElement($showsum_radio);
    // DESCRIPTION
    $description_text = new XoopsFormDhtmlTextArea(_AM_SPARTNER_DESCRIPTION, 'description', $partnerObj->description(0, 'e'), 15, 60);
    $description_text->setDescription(_AM_SPARTNER_DESCRIPTION_DSC);
    $sform->addElement($description_text, false);
    // CONTACT_NAME
    $contact_name_text = new XoopsFormText(_CO_SPARTNER_CONTACT_NAME, 'contact_name', 50, 255, $partnerObj->contact_name('e'));
    $contact_name_text->setDescription(_CO_SPARTNER_CONTACT_NAME_DSC);
    $sform->addElement($contact_name_text, false);
    // CONTACT_EMAIL
    $contact_email_text = new XoopsFormText(_CO_SPARTNER_CONTACT_EMAIL, 'contact_email', 50, 255, $partnerObj->contact_email('e'));
    $contact_email_text->setDescription(_CO_SPARTNER_CONTACT_EMAIL_DSC);
    $sform->addElement($contact_email_text, false);
    // EMAIL_PRIV
    $email_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_EMAILPRIV, 'email_priv', $partnerObj->email_priv('e'));
    $email_priv_radio->setDescription(_CO_SPARTNER_CONTACT_EMAILPRIV_DSC);
    $sform->addElement($email_priv_radio);
    // CONTACT_PHONE
    $contact_phone_text = new XoopsFormText(_CO_SPARTNER_CONTACT_PHONE, 'contact_phone', 50, 255, $partnerObj->contact_phone('e'));
    $contact_phone_text->setDescription(_CO_SPARTNER_CONTACT_PHONE_DSC);
    $sform->addElement($contact_phone_text, false);
    // PHONE_PRIV
    $phone_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_PHONEPRIV, 'phone_priv', $partnerObj->phone_priv('e'));
    $phone_priv_radio->setDescription(_CO_SPARTNER_CONTACT_PHONEPRIV_DSC);
    $sform->addElement($phone_priv_radio);
    // ADRESS
    //$adress_text = new XoopsFormText(_CO_SPARTNER_ADRESS, 'adress', 50, 255, $partnerObj->adress('e'));
    $adress_text = new XoopsFormTextArea(_CO_SPARTNER_ADRESS, 'adress', $partnerObj->adress('e'));
    $adress_text->setDescription(_CO_SPARTNER_ADRESS_DSC);
    $sform->addElement($adress_text, false);
    // ADRESS_PRIV
    $adress_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_ADRESSPRIV, 'adress_priv', $partnerObj->adress_priv('e'));
    $adress_priv_radio->setDescription(_CO_SPARTNER_CONTACT_ADRESSPRIV_DSC);
    $sform->addElement($adress_priv_radio);
    // STATUS
    $options = $partnerObj->getAvailableStatus();
    $status_select = new XoopsFormSelect(_AM_SPARTNER_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SPARTNER_STATUS_DSC);
    $sform->addElement($status_select);
    // WEIGHT
    $weight_text = new XoopsFormText(_AM_SPARTNER_WEIGHT, 'weight', 4, 4, $partnerObj->weight());
    $weight_text->setDescription(_AM_SPARTNER_WEIGHT_DSC);
    $sform->addElement($weight_text);
    //perms
    global $smartpermissions_handler;
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
    $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);
    if ($partnerObj->id() != 0) {
        $grantedGroups = $smartpermissions_handler->getGrantedGroups('full_view', $partnerObj->id());
    } else {
        $grantedGroups = $xoopsModuleConfig['default_full_view'];
    }
    $full_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_FULL_PERM_READ, 'full_view', true, $grantedGroups, 5, true);
    $full_view_select->setDescription(_CO_SPARTNER_FULL_PERM_READ_DSC);
    $sform->addElement($full_view_select);
    if ($partnerObj->id() != 0) {
        $partGrantedGroups = $smartpermissions_handler->getGrantedGroups('partial_view', $partnerObj->id());
    } else {
        $partGrantedGroups = $xoopsModuleConfig['default_part_view'];
    }
    $part_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_PART_PERM_READ, 'partial_view', true, $partGrantedGroups, 5, true);
    $part_view_select->setDescription(_CO_SPARTNER_PART_PERM_READ_DSC);
    $sform->addElement($part_view_select);
    // Partner id
    $sform->addElement(new XoopsFormHidden('id', $partnerObj->id()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addpartner');
    $button_tray->addElement($hidden);
    $sform->addElement(new XoopsFormHidden('original_status', $partnerObj->status()));
    if (!$id) {
        // there's no id? Then it's a new partner
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SPARTNER_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SPARTNER_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addpartner\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SPARTNER_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // else, we're editing an existing partner
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SPARTNER_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addpartner\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    unset($hidden);
    if (!$id) {
        smartpartner_close_collapsable('addpartner', 'addpartnericon');
    } else {
        smartpartner_close_collapsable('editpartner', 'editpartnericon');
    }
    if ($id != 0) {
        showfiles($partnerObj);
    }
}
예제 #26
0
function b_ams_spotlight_edit($options)
{
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    include_once XOOPS_ROOT_PATH . "/modules/AMS/include/functions.inc.php";
    global $xoopsModule;
    AMS_updateCache();
    if (!isset($xoopsModule) || $xoopsModule->getVar('dirname') != "AMS") {
        $module_handler =& xoops_gethandler('module');
        $module =& $module_handler->getByDirname("AMS");
    } else {
        $module =& $xoopsModule;
    }
    $config_handler =& xoops_gethandler('config');
    $moduleConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
    $templates_list = array_flip($moduleConfig['spotlight_template']);
    //fix template list value lost after module update
    foreach ($templates_list as $k => $v) {
        $templates_list[$k] = substr($k, 20, strlen($k) - 25);
    }
    $form = new XoopsFormElementTray('', '<br/><br />');
    $numarticles_select = new XoopsFormText(_AMS_MB_SPOT_NUMARTICLES, 'options[0]', 10, 10, $options[0]);
    $form->addElement($numarticles_select);
    $form->addElement(new XoopsFormRadioYN(_AMS_MB_SPOT_SHOWMINISTATS, 'options[1]', $options[1]));
    //spotlight template selection
    $template_select = new XoopsFormSelect(_AMS_MB_SPOTLIGHT_TEMPLATE, 'options[2]', $options[2]);
    $template_select->addOptionArray($templates_list);
    $template_select->setExtra("onchange='showImgSelected(\"template_preview\", \"options[2]\", \"" . '/modules/AMS/images/spotlight_preview' . "\", \".jpg\", \"" . XOOPS_URL . "\")'");
    $template_select->setDescription(_AMS_MB_SPOTLIGHT_TEMPLATE_DESC);
    $form->addElement($template_select);
    //spotlight preview image
    $imgpath = sprintf('', "modules/AMS/images/spotlight_preview/");
    $form->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/modules/AMS/images/spotlight_preview/" . $options[2] . ".jpg' name='template_preview' id='template_preview' alt='' />"));
    return $form->render();
}
예제 #27
0
/**
 * Metagen
 *
 * Metagen is a system that can help you to have your page best indexed by search engines.
 * Except if you type meta keywords and meta descriptions yourself, the module will automatically create them.
 * From here you can also manage some other options like the maximum number of meta keywords to create and
 * the keywords apparition's order.
 */
function Metagen()
{
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $cfg;
    xoops_cp_header();
    $myts =& MyTextSanitizer::getInstance();
    if (file_exists(XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php')) {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php';
    } else {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/english/main.php';
    }
    adminmenu(8);
    echo "<h1>" . _AM_NEWS_METAGEN . "</h1>";
    echo _AM_NEWS_METAGEN_DESC . "<br /><br />";
    // Metagen Options
    $registry = new news_registryfile('news_metagen_options.txt');
    $content = '';
    $content = $registry->getfile();
    if (xoops_trim($content) != '') {
        list($keywordscount, $keywordsorder) = explode(',', $content);
    } else {
        $keywordscount = $cfg['meta_keywords_count'];
        $keywordsorder = $cfg['meta_keywords_order'];
    }
    $sform = new XoopsThemeForm(_OPTIONS, 'metagenoptions', XOOPS_URL . '/modules/news/admin/index.php', 'post');
    $sform->addElement(new XoopsFormHidden('op', 'metagenoptions'), false);
    $sform->addElement(new XoopsFormText(_AM_NEWS_META_KEYWORDS_CNT, 'keywordscount', 4, 6, $keywordscount), true);
    $keywordsorder = new XoopsFormRadio(_AM_NEWS_META_KEYWORDS_ORDER, 'keywordsorder', $keywordsorder);
    $keywordsorder->addOption(0, _AM_NEWS_META_KEYWORDS_INTEXT);
    $keywordsorder->addOption(1, _AM_NEWS_META_KEYWORDS_FREQ1);
    $keywordsorder->addOption(2, _AM_NEWS_META_KEYWORDS_FREQ2);
    $sform->addElement($keywordsorder, false);
    $button_tray = new XoopsFormElementTray('', '');
    $submit_btn = new XoopsFormButton('', 'post', _AM_MODIFY, 'submit');
    $button_tray->addElement($submit_btn);
    $sform->addElement($button_tray);
    $sform->display();
    // Blacklist
    $sform = new XoopsThemeForm(_AM_NEWS_BLACKLIST, 'metagenblacklist', XOOPS_URL . '/modules/news/admin/index.php', 'post');
    $sform->addElement(new XoopsFormHidden('op', 'metagenblacklist'), false);
    // Remove words
    $remove_tray = new XoopsFormElementTray(_AM_NEWS_BLACKLIST);
    $remove_tray->setDescription(_AM_NEWS_BLACKLIST_DESC);
    $blacklist = new XoopsFormSelect('', 'blacklist', '', 5, true);
    $words = array();
    $metablack = new news_blacklist();
    $words = $metablack->getAllKeywords();
    if (is_array($words) && count($words) > 0) {
        foreach ($words as $key => $value) {
            $blacklist->addOption($key, $value);
        }
    }
    $blacklist->setDescription(_AM_NEWS_BLACKLIST_DESC);
    $remove_tray->addElement($blacklist, false);
    $remove_btn = new XoopsFormButton('', 'go', _AM_DELETE, 'submit');
    $remove_tray->addElement($remove_btn, false);
    $sform->addElement($remove_tray);
    // Add some words
    $add_tray = new XoopsFormElementTray(_AM_NEWS_BLACKLIST_ADD);
    $add_tray->setDescription(_AM_NEWS_BLACKLIST_ADD_DSC);
    $add_field = new XoopsFormTextArea('', 'keywords', '', 5, 70);
    $add_tray->addElement($add_field, false);
    $add_btn = new XoopsFormButton('', 'go', _AM_ADD, 'submit');
    $add_tray->addElement($add_btn, false);
    $sform->addElement($add_tray);
    $sform->display();
}
예제 #28
0
 /**
  * XoopsfaqContents::displayForm()
  *
  * @return
  */
 function displayForm()
 {
     global $xoopsModuleConfig;
     $category_handler =& xoops_getModuleHandler('category');
     if (!$category_handler->getCount()) {
         xoops_error(_AM_XOOPSFAQ_ERRORNOCAT, $title = '');
         xoops_cp_footer();
         exit;
     }
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $caption = $this->isNew() ? _AM_XOOPSFAQ_CREATENEW : sprintf(_AM_XOOPSFAQ_MODIFYITEM, $this->getVar('contents_title'));
     $form = new XoopsThemeForm($caption, 'content', $_SERVER['REQUEST_URI']);
     $form->addElement(new XoopsFormHiddenToken());
     $form->addElement(new xoopsFormHidden('op', 'save'));
     $form->addElement(new xoopsFormHidden('contents_id', $this->getVar('contents_id', 'e')));
     // title
     $category_handler =& xoops_getModuleHandler('category');
     $objects = $category_handler->getList();
     $contents_cid = new XoopsFormSelect(_AM_XOOPSFAQ_E_CONTENTS_CATEGORY, 'contents_cid', $this->getVar('contents_cid', 'e'), 1, false);
     $contents_cid->setDescription(_AM_XOOPSFAQ_E_CONTENTS_CATEGORY_DSC);
     $contents_cid->addOptionArray($objects);
     $form->addElement($contents_cid);
     $contents_title = new XoopsFormText(_AM_XOOPSFAQ_E_CONTENTS_TITLE, 'contents_title', 50, 150, $this->getVar('contents_title', 'e'));
     $contents_title->setDescription(_AM_XOOPSFAQ_E_CONTENTS_TITLE_DSC);
     $form->addElement($contents_title, true);
     /**
      */
     $options_tray = new XoopsFormElementTray(_AM_XOOPSFAQ_E_CONTENTS_CONTENT, '<br />');
     if (class_exists('XoopsFormEditor')) {
         $options['name'] = 'contents_contents';
         $options['value'] = $this->getVar('contents_contents', 'e');
         $options['rows'] = 25;
         $options['cols'] = '100%';
         $options['width'] = '100%';
         $options['height'] = '600px';
         $contents_contents = new XoopsFormEditor('', $xoopsModuleConfig['use_wysiwyg'], $options, $nohtml = false, $onfailure = 'textarea');
         $options_tray->addElement($contents_contents);
     } else {
         $contents_contents = new XoopsFormDhtmlTextArea('', 'contents_contents', $this->getVar('contents_contents', 'e'), '100%', '100%');
         $options_tray->addElement($contents_contents);
     }
     $options_tray->setDescription(_AM_XOOPSFAQ_E_CONTENTS_CONTENT_DSC);
     if (false == xoopsFaq_isEditorHTML()) {
         if ($this->isNew()) {
             $this->setVar('dohtml', 0);
             $this->setVar('dobr', 1);
         }
         $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml', 'e'));
         $html_checkbox->addOption(1, _AM_XOOPSFAQ_E_DOHTML);
         $options_tray->addElement($html_checkbox);
         $breaks_checkbox = new XoopsFormCheckBox('', 'dobr', $this->getVar('dobr', 'e'));
         $breaks_checkbox->addOption(1, _AM_XOOPSFAQ_E_BREAKS);
         $options_tray->addElement($breaks_checkbox);
     } else {
         $form->addElement(new xoopsFormHidden('dohtml', 1));
         $form->addElement(new xoopsFormHidden('dobr', 0));
     }
     $doimage_checkbox = new XoopsFormCheckBox('', 'doimage', $this->getVar('doimage', 'e'));
     $doimage_checkbox->addOption(1, _AM_XOOPSFAQ_E_DOIMAGE);
     $options_tray->addElement($doimage_checkbox);
     $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode', 'e'));
     $xcodes_checkbox->addOption(1, _AM_XOOPSFAQ_E_DOXCODE);
     $options_tray->addElement($xcodes_checkbox);
     $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley', 'e'));
     $smiley_checkbox->addOption(1, _AM_XOOPSFAQ_E_DOSMILEY);
     $options_tray->addElement($smiley_checkbox);
     $form->addElement($options_tray);
     $contents_publish = new XoopsFormTextDateSelect(_AM_XOOPSFAQ_E_CONTENTS_PUBLISH, 'contents_publish', 20, $this->getVar('contents_publish'), $this->isNew());
     $contents_publish->setDescription(_AM_XOOPSFAQ_E_CONTENTS_PUBLISH_DSC);
     $form->addElement($contents_publish);
     $contents_weight = new XoopsFormText(_AM_XOOPSFAQ_E_CONTENTS_WEIGHT, 'contents_weight', 5, 5, $this->getVar('contents_weight', 'e'));
     $contents_weight->setDescription(_AM_XOOPSFAQ_E_CONTENTS_WEIGHT_DSC);
     $form->addElement($contents_weight, false);
     $contents_active = new XoopsFormRadioYN(_AM_XOOPSFAQ_E_CONTENTS_ACTIVE, 'contents_active', $this->getVar('contents_active', 'e'), ' ' . _YES . '', ' ' . _NO . '');
     $contents_active->setDescription(_AM_XOOPSFAQ_E_CONTENTS_ACTIVE_DSC);
     $form->addElement($contents_active, false);
     //$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     $btnTray = new XoopsFormElementTray('', '');
     $btnSubmit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
     $btnTray->addElement($btnSubmit);
     $btnCancel = new XoopsFormButton('', '', _CANCEL, 'button');
     $btnCancel->setExtra('onclick="history.go(-1)"');
     $btnTray->addElement($btnCancel);
     $form->addElement($btnTray);
     $form->display();
 }