function awardPoints($userid, $function, $referrence, $info) { $app =& JFactory::getApplication(); $cwConfig =& CrosswordsHelper::get_configuration(); if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_AUP) == 0) { $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php'; if (file_exists($api_AUP)) { require_once $api_AUP; $aupid = AlphaUserPointsHelper::getAnyUserReferreID($userid); if ($aupid) { switch ($function) { case 1: //New Question AlphaUserPointsHelper::newpoints(AUP_NEW_QUESTION, $aupid, $referrence, $info); break; case 2: // Solved crossword AlphaUserPointsHelper::newpoints(AUP_SOLVE_CROSSWORD, $aupid, $referrence, $info); break; } } } } else { if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_JOMSOCIAL) == 0) { include_once JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php'; switch ($function) { case 1: //New Question CuserPoints::assignPoint(JSP_NEW_QUESTION, $userid); break; case 2: // New Answer CuserPoints::assignPoint(JSP_SOLVED_CROSSWORD, $userid); break; } } else { if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_TOUCH) == 0) { $API = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'api.php'; if (file_exists($API)) { require_once $API; switch ($function) { case 1: //New Question JSCommunityApi::increaseKarma($userid, $cwConfig[TOUCH_POINTS_NEW_QUESTION]); break; case 2: // New Answer JSCommunityApi::increaseKarma($userid, $cwConfig[TOUCH_POINTS_SOLVED_CROSSWORD]); break; } } } } } }
function display($tpl = null) { $model =& $this->getModel(); switch ($this->getLayout()) { case 'cpanel': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_CPANEL') . ']</small></small>', 'crosswords.png'); break; case 'crosswords': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_CROSSWORDS') . ']</small></small>', 'crosswords.png'); JToolBarHelper::custom('publish_crosswords', 'publish.png', 'publish.png', JText::_('LBL_PUBLISH'), true, false); JToolBarHelper::custom('unpublish_crosswords', 'unpublish.png', 'unpublish.png', JText::_('LBL_UNPUBLISH'), true, false); JToolBarHelper::custom('delete_crosswords', 'delete.png', 'delete.png', JText::_('LBL_DELETE'), true, false); $result =& $model->get_crosswords(); $this->assignRef('crosswords', $result->crosswords); $this->assignRef('users', $result->users); $this->assignRef('categories', $result->categories); $this->assignRef('lists', $result->lists); $this->assignRef('pagination', $result->pagination); break; case 'keyword_uses': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_CROSSWORDS') . ']</small></small>', 'crosswords.png'); JToolBarHelper::custom('publish_crosswords', 'publish.png', 'publish.png', JText::_('LBL_PUBLISH'), true, false); JToolBarHelper::custom('unpublish_crosswords', 'unpublish.png', 'unpublish.png', JText::_('LBL_UNPUBLISH'), true, false); JToolBarHelper::custom('delete_crosswords', 'delete.png', 'delete.png', JText::_('LBL_DELETE'), true, false); $keyid = JRequest::getVar('keyid', 0, '', 'int'); $ids =& $model->get_keyword_uses($keyid); if ($ids) { $ids = implode(",", $ids); $result =& $model->get_crosswords($ids); $this->assignRef('crosswords', $result->crosswords); $this->assignRef('users', $result->users); $this->assignRef('categories', $result->categories); $this->assignRef('lists', $result->lists); $this->assignRef('pagination', $result->pagination); } $this->setLayout('crosswords'); break; case 'keywords': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_KEYWORDS') . ']</small></small>', 'crosswords.png'); JToolBarHelper::custom('publish_keywords', 'publish.png', 'publish.png', JText::_('LBL_PUBLISH'), true, false); JToolBarHelper::custom('unpublish_keywords', 'unpublish.png', 'unpublish.png', JText::_('LBL_UNPUBLISH'), true, false); JToolBarHelper::custom('delete_keywords', 'delete.png', 'delete.png', JText::_('LBL_DELETE'), true, false); $result =& $model->get_keywords(); $this->assignRef('keywords', $result->keywords); $this->assignRef('users', $result->users); $this->assignRef('categories', $result->categories); $this->assignRef('lists', $result->lists); $this->assignRef('pagination', $result->pagination); break; case 'categories': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_CATEGORIES') . ']</small></small>', 'crosswords.png'); JToolBarHelper::custom('publish_categories', 'publish.png', 'publish.png', JText::_('LBL_PUBLISH'), true, false); JToolBarHelper::custom('unpublish_categories', 'unpublish.png', 'unpublish.png', JText::_('LBL_UNPUBLISH'), true, false); JToolBarHelper::custom('edit_category', 'new.png', 'new.png', JText::_('LBL_NEW'), false, false); $categories =& $model->get_categories(); $this->assignRef('categories', $categories); break; case 'config': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_CONFIG') . ']</small></small>', 'crosswords.png'); JToolBarHelper::custom('save_config', 'save.png', 'save.png', JText::_('LBL_SAVE'), false, false); $config =& CrosswordsHelper::get_configuration(true); $this->assignRef('config', $config); break; case 'about': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_ABOUT') . ']</small></small>', 'crosswords.png'); break; case 'crossword_form': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_EDIT_CROSSWORD') . ']</small></small>', 'crosswords.png'); JToolBarHelper::custom('save_crossword', 'save.png', 'save.png', JText::_('LBL_SAVE'), false, false); JToolBarHelper::custom('crosswords', 'cancel.png', 'cancel.png', JText::_('LBL_CANCEL'), false, false); $id = JRequest::getVar('cid', 0, '', 'int'); $crossword = new stdClass(); if ($id) { $crossword = $model->get_crossword($id); } $categories =& $model->get_categories(); $this->assignRef('crossword', $crossword); $this->assignRef('categories', $categories); break; case 'keyword_form': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_EDIT_KEYWORD') . ']</small></small>', 'crosswords.png'); JToolBarHelper::custom('save_keyword', 'save.png', 'save.png', JText::_('LBL_SAVE'), false, false); JToolBarHelper::custom('keywords', 'cancel.png', 'cancel.png', JText::_('LBL_CANCEL'), false, false); $id = JRequest::getVar('cid', 0, '', 'int'); $keyword = new stdClass(); if ($id) { $keyword = $model->get_keyword($id); } $categories =& $model->get_categories(); $this->assignRef('keyword', $keyword); $this->assignRef('categories', $categories); break; case 'category_form': JToolBarHelper::title(JText::_('TITLE_COMMUNITY_CROSSWORDS') . ': <small><small>[' . JText::_('LBL_EDIT_CATEGORY') . ']</small></small>', 'crosswords.png'); JToolBarHelper::custom('save_category', 'save.png', 'save.png', JText::_('LBL_SAVE'), false, false); JToolBarHelper::custom('categories', 'cancel.png', 'cancel.png', JText::_('LBL_CANCEL'), false, false); $id = JRequest::getVar('cid', 0, '', 'int'); $category = new stdClass(); if ($id) { $category = $model->get_category($id); } $this->assignRef('category', $category); break; } parent::display($tpl); }