function saveIFrame() { $errors = array(); $id = $this->save($errors); $helper = new JAVoiceHelpers(); $objects = array(); if ($id) { $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, 1); $message[] = JText::_("SAVE_DATA_SUCCESSFULLY"); $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, $message)); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors)); } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; }
function saveIFrame() { $post = JRequest::get('request', JREQUEST_ALLOWHTML); $number = $post['number']; $errors = array(); $id = $this->save($errors); $helper = new JAVoiceHelpers(); $objects = array(); if ($id) { $model = $this->getModel('forums'); $item = $model->getItem(); if ($post['id'] == '0') { $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, 1); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, JText::_("SAVE_DATA_SUCCESSFULLY"))); } $objects[] = $helper->parseProperty("html", "#title" . $item->id, $item->title); $objects[] = $helper->parsePropertyPublish("html", "#publish" . $item->id, $item->published, $number); $modelvoicetypes = JAVBModel::getInstance('voicetypes', 'javoiceModel'); $where = " AND ft.forums_id = {$item->id}"; $joins = " INNER JOIN #__jav_forums_has_voice_types as ft ON t.id = ft.voice_types_id"; $voicetypes = $modelvoicetypes->getDyamicItems($where, 't.title', 0, 0, 't.title', $joins); $strVoice = ''; if ($voicetypes) { $strVoice = implode(", ", $voicetypes); } $item->strvoice = $strVoice; $objects[] = $helper->parseProperty("html", "#voice-types-" . $item->id, $item->strvoice); $objects[] = $helper->parseProperty("value", "#order" . $item->id, $item->ordering); //$objects [] = $helper->parsePropertyPublisha ( $item->id, $item->published ); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors)); } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; }
function saveIFrame() { $post = JRequest::get('request'); $number = $post['number']; $errors = array(); $id = $this->save($errors); $helper = new JAVoiceHelpers(); $objects = array(); if (count($errors) == 0) { $model = $this->getModel('voicetypes'); $item = $model->getItem($id); if ($post['id'] == '0') { $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, 1); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, JText::_("SAVE_DATA_SUCCESSFULLY"))); } $objects[] = $helper->parseProperty("html", "#title" . $item->id, $item->title); $objects[] = $helper->parsePropertyPublish("html", "#publish" . $item->id, $item->published, $number); if ($item->total_votes < 0) { $item->total_votes = JText::_("UNLIMITED"); } $objects[] = $helper->parseProperty("html", "#total_votes" . $item->id, $item->total_votes); $objects[] = $helper->parseProperty("value", "#order" . $item->id, $item->ordering); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors)); } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; }
function saveAddUser() { $result = TRUE; $helper = new JAVoiceHelpers(); $objects = array(); $model = $this->getModel('configs'); $data = $model->getItems(); $item = JTable::getInstance('configs', 'Table'); $item->bind($data); $data = $item->data; $params = class_exists('JRegistry') ? new JRegistry($data) : new JParameter($data); $group = JRequest::getVar('group', NULL); if (!$group) { $result = FALSE; } if ($result) { $cid = JRequest::getVar('cid', array(0), '', 'array'); $user_id = ''; $cids = array(); if ($cid) { $cids[] = implode(',', $cid); } if ($params->get('permissions', '') != '') { $cids[] = $params->get('permissions', ''); } if ($cids) { $user_id = implode(',', $cids); } $params->set('permissions', $user_id); $item->group = $group; $item->data = $params->toString(); if ($item->store()) { $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, 1); $message[] = JText::_("SAVE_DATA_SUCCESSFULLY"); $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, $message)); } else { $message[] = JText::_("ERROR_OCCURRED_DATA_NOT_SAVED"); $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $message)); } } else { $message[] = JText::_("ERROR_OCCURRED_DATA_NOT_SAVED"); $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $message)); } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; }
function saveIFrame() { $post = JRequest::get('request'); $number = $post['number']; $errors = array(); $reload = 0; $id = $this->save($errors, $reload); $helper = new JAVoiceHelpers(); $objects = array(); if ($id) { $model = $this->getModel('voicetypesstatus'); $modelvoicetype = $this->getModel('voicetypes'); $item = $model->getItem($id); $voicetype = $modelvoicetype->getItem($item->voice_types_id); if ($post['id'] == '0') { $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, 1); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, JText::_("SAVE_DATA_SUCCESSFULLY"))); } $objects[] = $helper->parseProperty("html", "#title" . $item->id, $item->title); $objects[] = $helper->parseProperty("val", "#voice_types_id", $item->voice_types_id); $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, $reload); $objects[] = $helper->parseProperty("html", "#vtitle" . $item->id, $voicetype->title); $objects[] = $helper->parseProperty("style", "#class_css" . $item->id, "background:{$item->class_css};width:70px; height:15px;;float:left"); $objects[] = $helper->parseProperty("html", "#name" . $item->id, $item->name); $objects[] = $helper->parsePropertyPublish("html", "#publish" . $item->id, $item->published, $number); $objects[] = $helper->parsePropertyPublish("html", "#show_on_tab" . $item->id, $item->show_on_tab, $number, 'hidden', 'Show', 'Hidden'); $objects[] = $helper->parseProperty("html", "#title" . $item->id, $item->title); //$objects [] = $helper->parsePropertyPublisha ( $item->id, $item->published ); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors)); } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; }
function saveResponse() { global $javconfig; $model = $this->getModel('items'); $post = JRequest::get('request', JREQUEST_ALLOWRAW); $post['content'] = $post['newVoiceContent']; $model->setState('request', $post); $row = $model->store_admin_response(); $helper = new JAVoiceHelpers(); $objects = array(); $errors = array(); $objects = array(); $cid = JRequest::getVar('cid', array(0), '', 'array'); JArrayHelper::toInteger($cid, array(0)); if (!$cid) { $errors[] = JText::_("ERROR_OCCURRED_DATA_NOT_SAVED"); $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors)); } else { if ($row->id) { if ($javconfig['plugin']->get("is_attach_image", 0)) { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); //delete file in store image if remove file $listFile = JRequest::getVar('listfile', 0); $file_path = JPATH_ROOT . DS . "images" . DS . "stories" . DS . "ja_voice" . DS . "admin_response" . DS . $row->id; $listFileOfComments = JFolder::files($file_path); if ($listFileOfComments) { foreach ($listFileOfComments as $listFileOfComment) { if ($listFile) { if (!in_array($listFileOfComment, $listFile)) { JFile::delete($file_path . DS . $listFileOfComment); } } else { JFile::delete($file_path . DS . $listFileOfComment); } } } //die($_SESSION['javReplyTemp']."--"); if ($listFile) { if (isset($_SESSION['javReplyTemp'])) { $listFileTemp = JFolder::files($_SESSION['javReplyTemp']); if ($listFileTemp) { foreach ($listFileTemp as $file) { if (!in_array($file, $listFile, true)) { JFile::delete($_SESSION['javReplyTemp'] . DS . $file); } } } JRequest::setVar("listfile", implode(',', $listFile)); //move file $target_path = JPATH_ROOT . DS . "images" . DS . "stories" . DS . "ja_voice" . DS . "admin_response" . DS . $row->id; if (!is_dir($target_path)) { JFolder::create($target_path); } if ($listFileTemp) { JFolder::copy($_SESSION['javReplyTemp'], $target_path, '', true); } JFolder::delete($_SESSION['javReplyTemp']); unset($_SESSION['javtemp']); unset($_SESSION['javReplyNameFolder']); } } } $message[] = JText::_("SAVE_DATA_SUCCESSFULLY"); $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, $message)); } else { $errors[] = JText::_("ERROR_OCCURRED_DATA_NOT_SAVED"); $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors)); } } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; }