8 require_once(CH_DIRECTORY_PATH_CLASSES .
'ChWsbModule.php');
20 $oQuoteUnit = $this->_oDb->getRandomQuote();
26 'unit_text' => $sUnitText,
27 'author' => $sUnitAuthor
30 $this->_oTemplate->addCss(
'unit.css');
31 return array($this->_oTemplate->parseHtmlByTemplateName(
'unit', $aVariables), array(), array(),
false);
38 require_once(CH_DIRECTORY_PATH_INC .
'admin_design.inc.php');
41 $iUnitID = ($sSubaction ==
'edit' && (int)$sID > 0) ? (int)$sID : 0;
42 $iUnitID = (
ch_get(
'action') ==
'edit' && (int)
ch_get(
'ID') > 0) ? (
int)
ch_get(
'ID') : $iUnitID;
44 if (isset($_POST[
'quotes_list']) && is_array($_POST[
'quotes_list'])) {
45 foreach($_POST[
'quotes_list']
as $sQuoteId) {
46 $iQuoteId = (int)$sQuoteId;
48 case isset($_POST[
'action_delete']):
49 $this->_oDb->deleteUnit($iQuoteId);
58 'css_name' => array(),
60 'header' =>
_t(
'_adm_page_cpt_quotes'),
61 'header_text' =>
_t(
'_adm_box_cpt_quotes')
71 $sAddNewC =
_t(
'_ch_quotes_add_new');
74 $sQText = $sQText =
'';
77 $aQinfo = $this->_oDb->getQuote($iUnitID);
78 $sQText = $aQinfo[
'Text'];
79 $sQAuthor = $aQinfo[
'Author'];
84 'form_attrs' => array(
85 'name' =>
'create_quotes_form',
86 'action' => CH_WSB_URL_ROOT .
'modules/?r=quotes/administration/',
91 'table' =>
'ch_quotes_units',
93 'submit_name' =>
'add_button',
103 'type' =>
'textarea',
105 'caption' =>
_t(
'_ch_quotes_text'),
110 'params' => array(3,1024),
111 'error' =>
_t(
'_ch_quotes_text_err', 1024),
120 'caption' =>
_t(
'_ch_quotes_author'),
122 'value' => $sQAuthor,
125 'params' => array(3,128),
126 'error' =>
_t(
'_ch_quotes_author_err', 128),
132 'add_button' => array(
134 'name' =>
'add_button',
135 'value' =>
_t(
'_Submit'),
141 $aForm[
'inputs'][
'hidden_unitid'] = array(
152 if (
$oForm->isSubmittedAndValid()) {
156 $aValsAdd = array ();
160 $oForm->update($iUnitID, $aValsAdd);
164 $iLastId =
$oForm->insert($aValsAdd);
174 $sExistedC =
_t(
'_ch_quotes_existed_list');
176 if (isset(
$GLOBALS[
'oAdmTemplate'])) {
177 $GLOBALS[
'oAdmTemplate']->addDynamicLocation($this->_oConfig->getHomePath(), $this->_oConfig->getHomeUrl());
178 $GLOBALS[
'oAdmTemplate'] -> addCss(
'unit.css');
181 $sAction = CH_WSB_URL_ROOT .
'modules/?r=quotes/administration/';
184 $aAllQuotes = $this->_oDb->getAllQuotes();
185 foreach ($aAllQuotes
as $iID => $aQuoteInfo) {
186 $sBgClr = ($iID % 2 == 0) ?
'#EEE' :
'#FFF';
187 $iQId = (int)$aQuoteInfo[
'ID'];
191 $aVariables = array (
194 'unit_author' => $sQAuthor,
196 'unit_text' => $sQText
198 $sQuotes .= $this->_oTemplate->parseHtmlByTemplateName(
'adm_unit', $aVariables);
203 $sAdmPanel = $oSearchResult->showAdminActionsPanel(
'quotes_box', array(
'action_delete' =>
'_Delete'),
'quotes_list');
207 <div
class=
"adm-db-content-wrapper ch-def-bc-margin">
208 <div
id=
"quotes_box">
210 <div
class=
"clear_both"></div>
219 'add_unit' => array(
'href' =>
$sAction,
'title' =>
_t(
'_ch_quotes_add_new'),
'onclick' =>
'',
'active' => 0),