XoopsModules25x /
soapbox
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Module: Soapbox |
||
| 4 | * Version: v 1.5 |
||
| 5 | * Release Date: 23 August 2004 |
||
| 6 | * Author: hsalazar |
||
| 7 | * Licence: GNU |
||
| 8 | */ |
||
| 9 | |||
| 10 | use XoopsModules\Soapbox; |
||
| 11 | |||
| 12 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||
| 13 | if (file_exists(XOOPS_ROOT_PATH . '/language/' . $myts->htmlSpecialChars($xoopsConfig['language']) . '/calendar.php')) { |
||
| 14 | require_once XOOPS_ROOT_PATH . '/language/' . $myts->htmlSpecialChars($xoopsConfig['language']) . '/calendar.php'; |
||
| 15 | } else { |
||
| 16 | require_once XOOPS_ROOT_PATH . '/language/english/calendar.php'; |
||
| 17 | } |
||
| 18 | //require_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; |
||
| 19 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||
| 20 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 21 | |||
| 22 | /** @var Soapbox\Helper $helper */ |
||
| 23 | $helper = Soapbox\Helper::getInstance(); |
||
| 24 | |||
| 25 | $sform = new \XoopsThemeForm(_MD_SOAPBOX_SUB_SMNAME, 'storyform', $myts->htmlSpecialChars(xoops_getenv('PHP_SELF')), 'post', true); |
||
| 26 | //get select category object |
||
| 27 | if (is_object($xoopsUser)) { |
||
| 28 | if ($xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { |
||
| 29 | $canEditCategoryobArray = $entrydataHandler->getColumns(null, true); |
||
| 30 | } else { |
||
| 31 | $canEditCategoryobArray = $entrydataHandler->getColumnsByAuthor($xoopsUser->uid(), true); |
||
| 32 | } |
||
| 33 | |||
| 34 | //---------------------------- |
||
| 35 | $collist = []; |
||
| 36 | foreach ($canEditCategoryobArray as $key => $_can_edit_categoryob) { |
||
| 37 | $collist[$key] = $_can_edit_categoryob->getVar('name'); |
||
| 38 | } |
||
| 39 | $col_select = new \XoopsFormSelect('', 'columnID', (int)$e_articles['columnID']); |
||
| 40 | $col_select->addOptionArray($collist); |
||
| 41 | $col_select_tray = new \XoopsFormElementTray(_MD_SOAPBOX_COLUMN, '<br>'); |
||
| 42 | $col_select_tray->addElement($col_select); |
||
| 43 | $sform->addElement($col_select_tray); |
||
| 44 | } |
||
| 45 | // This part is common to edit/add |
||
| 46 | // HEADLINE, LEAD, BODYTEXT |
||
| 47 | $sform->addElement(new \XoopsFormText(_MD_SOAPBOX_ARTHEADLINE, 'headline', 50, 50, $e_articles['headline']), true); |
||
| 48 | |||
| 49 | // LEAD |
||
| 50 | $sform->addElement(new \XoopsFormTextArea(_MD_SOAPBOX_ARTLEAD, 'lead', $e_articles['lead'], 10, 120)); |
||
| 51 | //$editor_lead=soapbox_getWysiwygForm($helper->getConfig('editorUser') , _MD_SOAPBOX_ARTLEAD , 'lead' , $e_articles['lead'] , '100%', '200px'); |
||
| 52 | //$sform->addElement($editor_lead,true); |
||
| 53 | |||
| 54 | // TEASER |
||
| 55 | $sform->addElement(new \XoopsFormTextArea(_MD_SOAPBOX_ARTTEASER, 'teaser', $e_articles['teaser'], 10, 120)); |
||
| 56 | //$editor_teaser=soapbox_getWysiwygForm($helper->getConfig('editorUser') , _MD_SOAPBOX_ARTTEASER ,'teaser', $e_articles['teaser'] , '100%', '120px'); |
||
| 57 | //$sform->addElement($editor_teaser,true); |
||
| 58 | |||
| 59 | $autoteaser_radio = new \XoopsFormRadioYN(_MD_SOAPBOX_AUTOTEASER, 'autoteaser', 0, ' ' . _MD_SOAPBOX_YES . '', ' ' . _MD_SOAPBOX_NO . ''); |
||
| 60 | $sform->addElement($autoteaser_radio); |
||
| 61 | $sform->addElement(new \XoopsFormText(_MD_SOAPBOX_AUTOTEASERAMOUNT, 'teaseramount', 4, 4, 100)); |
||
| 62 | |||
| 63 | $sform->addElement(new \XoopsFormDhtmlTextArea(_MD_SOAPBOX_ARTBODY, 'bodytext', $e_articles['bodytext'], 20, 120)); |
||
| 64 | /* |
||
| 65 | if (null !== ($helper->getConfig('editorUser')) ) { |
||
| 66 | $editor=soapbox_getWysiwygForm($helper->getConfig('editorUser') , _MD_SOAPBOX_ARTBODY, 'bodytext', $e_articles['bodytext'] , '100%', '400px'); |
||
| 67 | $sform->addElement($editor,true); |
||
| 68 | } else { |
||
| 69 | $sform -> addElement( new \XoopsFormDhtmlTextArea( _MD_SOAPBOX_ARTBODY, 'bodytext', $e_articles['bodytext'], 20, 120 ) ); |
||
| 70 | } |
||
| 71 | */ |
||
| 72 | |||
| 73 | // The article CAN have its own image :) |
||
| 74 | // First, if the article's image doesn't exist, set its value to the blank file |
||
| 75 | if (empty($e_articles['artimage']) |
||
| 76 | || !file_exists(XOOPS_ROOT_PATH . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '/' . $e_articles['artimage'])) { |
||
| 77 | $artimage = 'blank.png'; |
||
| 78 | } |
||
| 79 | // Code to create the image selector |
||
| 80 | $graph_array = \XoopsLists:: getImgListAsArray(XOOPS_ROOT_PATH . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir'))); |
||
| 81 | $artimage_select = new \XoopsFormSelect('', 'artimage', $e_articles['artimage']); |
||
| 82 | $artimage_select->addOptionArray($graph_array); |
||
| 83 | $artimage_select->setExtra("onchange='showImgSelected(\"image5\", \"artimage\", \"" . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '", "", "' . XOOPS_URL . "\")'"); |
||
| 84 | $artimage_tray = new \XoopsFormElementTray(_MD_SOAPBOX_SELECT_IMG, ' '); |
||
| 85 | $artimage_tray->addElement($artimage_select); |
||
| 86 | $artimage_tray->addElement(new \XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . '/' . $myts->htmlSpecialChars($helper->getConfig('sbuploaddir')) . '/' . $e_articles['artimage'] . "' name='image5' id='image5' alt=''>")); |
||
| 87 | $sform->addElement($artimage_tray); |
||
| 88 | |||
| 89 | if (is_object($xoopsUser)) { |
||
| 90 | // WEIGHT |
||
| 91 | $sform->addElement(new \XoopsFormText(_MD_SOAPBOX_WGT, 'weight', 4, 4, $e_articles['weight'])); |
||
| 92 | //---------- |
||
| 93 | // datesub |
||
| 94 | //---------- |
||
| 95 | //$datesub_caption = $myts->htmlSpecialChars(formatTimestamp($e_articles['datesub'], $helper->getConfig('dateformat')) . '=>'); |
||
| 96 | //$datesub_tray = new \XoopsFormDateTime(_MD_SOAPBOX_POSTED . '<br>' . $datesub_caption, 'datesub', 15, time()); |
||
| 97 | $datesub_tray = new \XoopsFormDateTime(_MD_SOAPBOX_POSTED . '<br>', 'datesub', 15, $e_articles['datesub']); |
||
| 98 | // you don't want to change datesub |
||
| 99 | $datesubnochage_checkbox = new \XoopsFormCheckBox(_MD_SOAPBOX_DATESUBNOCHANGE, 'datesubnochage', 0); |
||
| 100 | $datesubnochage_checkbox->addOption(1, _MD_SOAPBOX_YES); |
||
| 101 | $datesub_tray->addElement($datesubnochage_checkbox); |
||
| 102 | $sform->addElement($datesub_tray); |
||
| 103 | //----------- |
||
| 104 | |||
| 105 | // COMMENTS |
||
| 106 | if (isset($GLOBALS['xoopsModuleConfig']['globaldisplaycomments']) |
||
| 107 | && 1 === $GLOBALS['xoopsModuleConfig']['globaldisplaycomments']) { |
||
| 108 | // COMMENTS |
||
| 109 | // Code to allow comments |
||
| 110 | $addcommentable_radio = new \XoopsFormRadioYN(_MD_SOAPBOX_ALLOWCOMMENTS, 'commentable', $e_articles['commentable'], ' ' . _MD_SOAPBOX_YES . '', ' ' . _MD_SOAPBOX_NO . ''); |
||
| 111 | $sform->addElement($addcommentable_radio); |
||
| 112 | } |
||
| 113 | if (null !== $helper->getConfig('autoapprove') && 1 === $helper->getConfig('autoapprove')) { |
||
| 114 | if ($xoopsUser->isAdmin($xoopsModule->mid())) { |
||
| 115 | // OFFLINE |
||
| 116 | // Code to take article offline, for maintenance purposes |
||
| 117 | $offline_radio = new \XoopsFormRadioYN(_MD_SOAPBOX_SWITCHOFFLINE, 'offline', $e_articles['offline'], ' ' . _MD_SOAPBOX_YES . '', ' ' . _MD_SOAPBOX_NO . ''); |
||
| 118 | $sform->addElement($offline_radio); |
||
| 119 | } else { |
||
| 120 | // submit user |
||
| 121 | // Code to take article offline, for maintenance purposes |
||
| 122 | $submit_radio = new \XoopsFormRadioYN(_MD_SOAPBOX_SWITCHSUBMITS, 'submit', $e_articles['submit'], ' ' . _MD_SOAPBOX_YES . '', ' ' . _MD_SOAPBOX_NO . ''); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 123 | $sform->addElement($submit_radio); |
||
| 124 | } |
||
| 125 | |||
| 126 | // ARTICLE IN BLOCK |
||
| 127 | // Code to put article in block |
||
| 128 | $block_radio = new \XoopsFormRadioYN(_MD_SOAPBOX_BLOCK, 'block', $e_articles['block'], ' ' . _MD_SOAPBOX_YES . '', ' ' . _MD_SOAPBOX_NO . ''); |
||
| 129 | $sform->addElement($block_radio); |
||
| 130 | |||
| 131 | // notification public |
||
| 132 | $notifypub_radio = new \XoopsFormRadioYN(_MD_SOAPBOX_NOTIFY, 'notifypub', $e_articles['notifypub'], ' ' . _MD_SOAPBOX_YES . '', ' ' . _MD_SOAPBOX_NO . ''); |
||
| 133 | $sform->addElement($notifypub_radio); |
||
| 134 | } |
||
| 135 | |||
| 136 | if (isset($e_articles['articleID']) && !empty($e_articles['articleID'])) { |
||
| 137 | $sform->addElement(new \XoopsFormHidden('articleID', $e_articles['articleID'])); |
||
| 138 | } |
||
| 139 | } |
||
| 140 | |||
| 141 | $buttonTray = new \XoopsFormElementTray('', ''); |
||
| 142 | $hidden = new \XoopsFormHidden('op', 'post'); |
||
| 143 | $buttonTray->addElement($hidden); |
||
| 144 | $buttonTray->addElement(new \XoopsFormButton('', 'post', _MD_SOAPBOX_CREATE, 'submit')); |
||
| 145 | |||
| 146 | $sform->addElement($buttonTray); |
||
| 147 | //----------- |
||
| 148 | //$xoopsGTicket->addTicketXoopsFormElement($sform, __LINE__); |
||
| 149 | //----------- |
||
| 150 | $sform->display(); |
||
| 151 | unset($hidden); |
||
| 152 |