예제 #1
0
 /**
  * Constructor
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     // browser paraméterek ellenörzése, ha kell javitása
     if (JRequest::getVar('limit') == '') {
         JRequest::setVar('limit', 20);
     }
     if (JRequest::getVar('limitstart') == '') {
         JRequest::setVar('limitstart', 0);
     }
     if (JRequest::getVar('order') == '') {
         JRequest::setVar('order', 1);
     }
     // általánosan használt helper
     if (file_exists(JPATH_BASE . DS . 'components' . DS . 'com_temakorok' . DS . 'helpers' . DS . 'temakorok.php')) {
         include JPATH_BASE . DS . 'components' . DS . 'com_temakorok' . DS . 'helpers' . DS . 'temakorok.php';
         $this->temakorokHelper = new TemakorokHelper();
     }
     // saját helper
     //if (file_exists(JPATH_COMPONENT.DS.'helpers'.DS.'temakorok.php')) {
     //  include JPATH_COMPONENT.DS.'helpers'.DS.'temakorok.php';
     //  $this->helper = new TemakorokHelper();
     //}
     if (isset($config['viewname'])) {
         $this->_viewname = $config['viewname'];
     }
     if (isset($config['mainmodel'])) {
         $this->_mainmodel = $config['mainmodel'];
     }
     if (isset($config['itemname'])) {
         $this->_itemname = $config['itemname'];
     }
     JRequest::setVar('view', $this->_viewname);
     $this->temakor_id = JRequest::getVar('temakor', 0);
     if ($this->temakor_id == '') {
         $this->temakor_id = 0;
     }
     $db = JFactory::getDBO();
     $temakorModel = new TemakorokModelTemakorok();
     $this->temakor = $temakorModel->getItem($this->temakor_id);
     $document =& JFactory::getDocument();
     $viewType = $document->getType();
     $this->model = $this->getModel($this->_mainmodel);
     $this->view = $this->getView($this->_viewname, $viewType);
     $this->view->setModel($this->model, true);
     $db->setQuery('select * from #__tagok 
     where temakor_id="' . $this->temakor_id . '" and user_id="' . JFactory::getUser()->id . '"');
     $res = $db->loadObject();
     if ($res) {
         $this->temakor_admin = $res->admin == 1;
     }
 }
예제 #2
0
 /**
  * képernyőn megadott adatok alapján képviselok rekord törlése - HA MEGENGEDETT
  * @return void
  * @JRequest integer temakor
  * @JRequest integer user
  */
 public function delete()
 {
     // Check for request forgeries
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $temakor_id = JRequest::getVar('temakor');
     // témakör beolvasása
     $temakorModel = new TemakorokModelTemakorok();
     $temakor = $temakorModel->getItem($temakor_id);
     if ($temakor == false) {
         $temakor = new stdclass();
         $temakor->id = 0;
         $temakor->megnevezes = 'Általános';
     }
     // hozzáférés ellenörzés
     if ($this->temakorokHelper->isAdmin($user) == false & $temakor->id > 0) {
         if ($temakor->lathatosag == 1 & $user->id == 0 | $temakor->lathatosag == 2 & $this->temakorokHelper->userTag($temakor->id, $user) == false) {
             $this->setMessage(JText::_('TEMAKOR_NEKED_NEM_ELERHETO'));
             $this->setRedirect(JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist' . '&task=browse');
             $this->redirect();
         }
     }
     if ($user->id = JRequest::getVar('user')) {
         // nézzük van-e képviseltje?
         $db->setQuery('select * from #__kepviselok
    where temakor_id=' . $temakor_id . ' and kepviselo_id=' . $user->id);
         $res = $db->loadObjectList();
         if (count($res) == 0) {
             $db->setQuery('delete from #__kepviselojeloltek
      where user_id=' . $user->id . ' and temakor_id=' . $temakor_id);
             if ($db->query()) {
                 $this->setMessage(JText::_('KEPVISELOJELOLTTOROLVE'));
             } else {
                 $this->setMessage($db->getErrorMsg());
             }
         } else {
             $this->setMessage(JText::_('NEMTOROLHETOVANKEPVISELTTAG'));
         }
         if ($temakor_id == 0) {
             $this->setRedirect(JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist');
         } else {
             $this->setRedirect(JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&temakor=' . $temakor_id);
         }
         $this->redirect();
     } else {
         echo '<div class="errorMsg">Access denied</div>';
         return;
     }
 }
예제 #3
0
 /**
  * a $item -ben adott temakor rekordhoz kapcsolodó kunena fórum kategória
  * létrehozása vagy modositása
  * @param mysql record object  $item 
  * @return boolean     
  */
 protected function storeKunenaCategory($newId, $item)
 {
     $result = true;
     $db = JFactory::getDBO();
     // $temakor GroupId meghatározása láthatóságtól függ lehet nulla is.
     $db->setQuery('SELECT id FROM #__usergroups WHERE title like "[' . $item->temakor_id . ']%"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     if ($res) {
         $gr = $res->id;
     } else {
         $gr = 1;
     }
     // témakör elérése
     $temakorModel = new TemakorokModelTemakorok();
     $temakor = $temakorModel->getItem($item->temakor_id);
     if ($temakor->lathatosag == 0) {
         $gr = 1;
         $params = '{"access_post":["6","2","8"],"access_reply":["6","2","8"]}';
     }
     if ($temakor->lathatosag == 1) {
         $gr = 2;
         $params = '{"access_post":["6","2","8"],"access_reply":["6","2","8"]}';
     }
     if ($temakor->lathatosag == 2) {
         $params = '{"access_post":["6","' . $gr . '",8"],"access_reply":["6","' . $gr . '",8"]}';
     }
     // szülő elérése
     $db->setQuery('SELECT id FROM #__kunena_categories WHERE alias="T' . $item->temakor_id . '"');
     $res = $db->loadObject();
     if ($res) {
         $parentId = $res->id;
     } else {
         $parentId = 85;
     }
     //li-de témakörök
     // meglévő rekord elérése
     $db->setQuery('SELECT id FROM #__kunena_categories WHERE alias="SZ' . $item->id . '"');
     $res = $db->loadObject();
     if ($db->getErrorNum() > 0) {
         $db->stderr();
     }
     // forum kategoria rekord összeállítása
     $data = array();
     if ($res) {
         $data['id'] = $res->id;
     } else {
         $data['id'] = 0;
     }
     $data['parent_id'] = $parentId;
     $data['name'] = strip_tags($item->megnevezes);
     $data['description'] = strip_tags($item->leiras);
     $data['pub_acces'] = $gr;
     $data['access_type'] = 'joomla.group';
     $data['access'] = 1;
     $data['alias'] = 'SZ' . $newId;
     $data['params'] = $params;
     $data['admin_access'] = 0;
     $data['admin_recurse'] = 1;
     $data['pub_recurse'] = 1;
     $data['published'] = 1;
     // 2015.05.08 tapasztalat: a kunena fórum nem kultiválja ahtml entity-ket
     $data['description'] = html_entity_decode($data['description'], ENT_COMPAT, 'UTF-8');
     $data['name'] = html_entity_decode($data['name'], ENT_COMPAT, 'UTF-8');
     // fórum kategoria rekord tárolása
     $category = new KunenaForumCategory($data);
     if ($data['id'] > 0) {
         $db->setQuery('UPDATE #__kunena_categories
    SET name="' . mysql_escape_string($data['name']) . '",
    description="' . mysql_escape_string($data['description']) . '",
    pub_access="' . $gr . '",
    params = "' . mysql_escape_string($params) . '"
    WHERE id="' . $data['id'] . '"');
         $db->query();
     } else {
         $category->save();
     }
     return $result;
 }
예제 #4
0
 /**
  * levél küldés a szavazásra jogosult usereknek - végrehajtás  view:emails
  * @JRequest integer szavazas
  * @JRequest integer temakor
  * @JRequest integer megnemszavazott   
  * @NEXTtasks com_alternativak.browse    
  */
 public function sendemails()
 {
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $db->setQuery('select * from #__szavazasok where id="' . JRequest::getVar('szavazas', 0) . '"');
     $szavazas = $db->loadObject();
     $temakorModel = new TemakorokModelTemakorok();
     $temakor = $temakorModel->getItem($szavazas->temakor_id);
     $subject = JRequest::getVar('subject', '');
     $mailbody = JRequest::getVar('mailbody', '', 'POST', 'STRING', JREQUEST_ALLOWHTML);
     echo $mailbosy . '<br />';
     $mailbody = str_replace('href="index.php', 'href="' . JURI::base() . 'index.php', $mailbody);
     $this->model->deleteOldEmailLog();
     $this->model->sendSzavazasToEmailQue($szavazas, $subject, $mailbody);
     $akciok['back'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativaklist&task=browse' . '&temakor=' . $szavazas->temakor_id . '&szavazas=' . $szavazas->id;
     $this->view->set('Szavazas', $szavazas);
     $this->view->set('Temakor', $temakor);
     $this->view->set('Akciok', $akciok);
     $this->view->setLayout('sended');
     $this->view->display();
 }