/**
  * Constructor
  */
 public function init()
 {
     $this->objContext = $this->getObject('dbcontext');
     $this->contextCode = $this->objContext->getContextCode();
     $this->objLanguage = $this->getObject('language', 'language');
     $this->title = ucwords($this->objLanguage->code2Txt('mod_context_contextstatistics', 'context', NULL, '[-context-] Statistics'));
 }
 /**
  * Constructor
  */
 public function init()
 {
     $this->objContext = $this->getObject('dbcontext');
     $this->contextCode = $this->objContext->getContextCode();
     $this->loadClass('link', 'htmlelements');
     $this->objContextModules = $this->getObject('dbcontextmodules');
     $this->objModules = $this->getObject('modules', 'modulecatalogue');
     $this->objLanguage = $this->getObject('language', 'language');
     $this->title = $this->objLanguage->code2Txt('mod_context_plugins', 'context', array('plugins' => 'plugins'), '[-plugins-]');
 }
 /**
  *Initialize by send the table name to be accessed
  */
 public function init()
 {
     $this->objContext = $this->getObject('dbcontext');
     $this->contextCode = $this->objContext->getContextCode();
     $this->loadClass('link', 'htmlelements');
     $this->objLanguage = $this->getObject('language', 'language');
     $this->title = ucwords($this->objLanguage->code2Txt('mod_context_contextsettings', 'context', NULL, '[-context-] Settings'));
     $this->objSysConfig = $this->getObject('dbsysconfig', 'sysconfig');
     $this->objUser = $this->getObject('user', 'security');
 }
 /**
  * Method to get the context menu
  *
  * @return string
  * @param  void
  * @access public
  */
 public function getContextMenu()
 {
     try {
         //initiate the objects
         $objSideBar = $this->newObject('sidebar', 'navigation');
         $objModules = $this->newObject('modules', 'modulecatalogue');
         //get the contextCode
         $this->objDBContext->getContextCode();
         //create the nodes array
         $nodes = array();
         //get the section id
         $section = $this->getParam('id');
         //create the home for the context
         $nodes[] = array('text' => $this->objDBContext->getMenuText() . ' -  ' . $this->objLanguage->languageText("word_home", 'system', 'Home'), 'uri' => $this->uri(NULL, "_default"));
         //get the registered modules for this context
         $arrContextModules = $this->objDBContextModules->getContextModules($this->contextCode);
         foreach ($arrContextModules as $contextModule) {
             $modInfo = $objModules->getModuleInfo($contextModule['moduleid']);
             $nodes[] = array('text' => $modInfo['name'], 'uri' => $this->uri(array('action' => 'contenthome', 'moduleid' => $contextModule['moduleid'])), 'sectionid' => $contextModule['moduleid']);
         }
         return $objSideBar->show($nodes, $this->getParam('id'));
     } catch (Exception $e) {
         echo 'Caught exception: ', $e->getMessage();
         exit;
     }
 }
Example #5
0
 /**
  * handles a theme uploaded from filemanager
  * @return <type>
  */
 public function __saveuploadedtheme()
 {
     $this->objContext = $this->getObject('dbcontext', 'context');
     $this->contextCode = $this->objContext->getContextCode();
     $objFileUpload = $this->getObject('uploadinput', 'filemanager');
     $path = '/context/' . $this->contextCode . '/canvases';
     $objFileUpload->customuploadpath = $path;
     $objFileUpload->enableOverwriteIncrement = TRUE;
     $results = $objFileUpload->handleUpload('fileupload');
     $file = $_FILES[$objFileUpload->name];
     $filename = $file['name'];
     // Technically, FALSE can never be returned, this is just a precaution
     // FALSE means there is no fileinput with that name
     if ($results == FALSE) {
         return $this->nextAction('view', array('id' => $this->getParam('id'), 'error' => 'unabletoupload'));
     } else {
         // If successfully Uploaded
         if ($results['success']) {
             $objZip = $this->newObject('wzip', 'utilities');
             $objZip->unzip($this->objConfig->getcontentBasePath() . '/' . $path . '/' . $filename, $this->objConfig->getcontentBasePath() . '/' . $path);
             return $this->nextAction('edit', array('contextcode' => $this->contextCode));
         } else {
             // If not successfully uploaded
             return $this->nextAction('uploadtheme', array('error' => $results['reason']));
         }
     }
 }
 /**
  * Method to create  the first node
  */
 public function createParentNode()
 {
     if (!$this->objDBParents->valueExists('tbl_context_parentnodes_has_tbl_context_tbl_context_contextCode', $this->objDBContext->getContextCode())) {
         $contextId = $this->objDBContext->getContextId();
         $contextCode = $this->objDBContext->getContextCode();
         //add a bridge to context and parent
         $this->objDBContextParents->insert(array('tbl_context_id' => $contextId, 'tbl_context_contextCode' => $contextCode));
         //add a parent node
         $parentId = $this->objDBParents->insert(array('tbl_context_parentnodes_has_tbl_context_tbl_context_id' => $contextId, 'tbl_context_parentnodes_has_tbl_context_tbl_context_contextCode' => $contextCode, 'userId' => $this->userId, 'dateCreated' => $this->objDBContext->getDate(), 'datemodified' => $this->objDBContext->getDate(), 'menu_text' => $this->objDBContext->getMenuText(), 'title' => $this->objDBContext->getTitle()));
     }
     $this->resetTable();
 }
Example #7
0
 /**
  * Method to leave a context
  *
  * @access protected
  */
 protected function __leavecontext()
 {
     if ($this->eventsEnabled) {
         $message = $this->objUser->fullname() . ' ' . $this->objLanguage->languageText('mod_context_hasleft', 'context') . ' ' . $this->contextCode;
         $this->eventDispatcher->post($this->objActivityStreamer, "context", array('title' => $message, 'link' => $this->uri(array()), 'contextcode' => $this->objContext->getContextCode(), 'author' => $this->objUser->fullname(), 'description' => $message));
     }
     $this->objContext->leaveContext();
     if ($this->objUser->isLoggedIn()) {
         return $this->nextAction(NULL, NULL, '_default');
     } else {
         // Workaround for bug in the engine class - it should really be unfucked in the engine class
         $objConfig = $this->getObject('altconfig', 'config');
         $goToPlace = $objConfig->getPrelogin('KEWL_PRELOGIN_MODULE');
         return $this->nextAction(NULL, NULL, $goToPlace);
     }
 }
 /**
  *Method to get all members for this context.
  * @return array|false of ids for members in current context, otherwise false.
  * @param  string      $contextCode
  */
 function getContextUsers($contextCode)
 {
     if ($this->_objDBContext->isInContext()) {
         if ($contextCode == '') {
             $this->_contextCode = $this->_objDBContext->getContextCode();
         } else {
             $this->_contextCode = $contextCode;
         }
         $path = array($this->_contextCode, $this->_contextGroup);
         $groupId = $this->_objGroupAdmin->getLeafId($path);
         // Get userIds of members
         $groupUsers = $this->_objGroupAdmin->getGroupUsers($groupId);
         $userIds = $this->_objGroupAdmin->getField($groupUsers, 'id');
         return $userIds;
     } else {
         return FALSE;
     }
 }