/** * Renderes the content of a single widget. * * @return string * @permissions view */ protected function actionGetWidgetContent() { //load the aspect and close the session afterwards class_module_system_aspect::getCurrentAspect(); $objWidgetModel = new class_module_dashboard_widget($this->getSystemid()); if ($objWidgetModel->rightView()) { $objConcreteWidget = $objWidgetModel->getConcreteAdminwidget(); if (!$objConcreteWidget->getBitBlockSessionClose()) { class_carrier::getInstance()->getObjSession()->sessionClose(); } //disable the internal changelog class_module_system_changelog::$bitChangelogEnabled = false; class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); $strReturn = json_encode($objConcreteWidget->generateWidgetOutput()); } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_UNAUTHORIZED); $strReturn = "<message><error>" . xmlSafeString($this->getLang("commons_error_permissions")) . "</error></message>"; } return $strReturn; }
/** * This callback is triggered on a users' first login into the system. * You may use this method to install a widget as a default widget to * a users dashboard. * * @param $strUserid * * @return bool */ public function onFistLogin($strUserid) { if (class_module_system_module::getModuleByName("system") !== null && class_module_system_aspect::getAspectByName("management") !== null) { $objDashboard = new class_module_dashboard_widget(); $objDashboard->setStrColumn("column3"); $objDashboard->setStrUser($strUserid); $objDashboard->setStrClass(__CLASS__); $objDashboard->setStrContent("a:1:{s:8:\"nrofrows\";s:1:\"1\";}"); return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("management")->getSystemid())); } return true; }
/** * This callback is triggered on a users' first login into the system. * You may use this method to install a widget as a default widget to * a users dashboard. * * @param $strUserid * * @return bool */ public function onFistLogin($strUserid) { if (class_module_system_aspect::getAspectByName("content") !== null) { $objDashboard = new class_module_dashboard_widget(); $objDashboard->setStrColumn("column2"); $objDashboard->setStrUser($strUserid); $objDashboard->setStrClass(__CLASS__); $objDashboard->setStrContent("a:1:{s:7:\"content\";s:1460:\"Welcome to Kajona V4!<br /><br />Kajona is developed by volunteers all over the world - show them your support by liking Kajona on facebook or donating a beer.<div id=\"fb-root\"></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = \"//connect.facebook.net/en_US/all.js#appId=141503865945925&xfbml=1\"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script><div class=\"fb-like\" data-href=\"https://www.facebook.com/pages/Kajona%C2%B3/156841314360532\" data-send=\"false\" data-layout=\"button_count\" data-width=\"60\" data-show-faces=\"false\"></div><form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"_donations\" /> <input type=\"hidden\" name=\"business\" value=\"donate@kajona.de\" /> <input type=\"hidden\" name=\"item_name\" value=\"Kajona Development\" /> <input type=\"hidden\" name=\"no_shipping\" value=\"0\" /> <input type=\"hidden\" name=\"no_note\" value=\"1\" /> <input type=\"hidden\" name=\"currency_code\" value=\"EUR\" /> <input type=\"hidden\" name=\"tax\" value=\"0\" /> <input type=\"hidden\" name=\"bn\" value=\"PP-DonationsBF\" /> <input type=\"image\" border=\"0\" src=\"https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\" /> <img height=\"1\" width=\"1\" border=\"0\" alt=\"\" src=\"https://www.paypal.com/en_US/i/scr/pixel.gif\" /></form>\";}"); return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("content")->getSystemid())); } return true; }
/** * This callback is triggered on a users' first login into the system. * You may use this method to install a widget as a default widget to * a users dashboard. * * @param $strUserid * * @return bool */ public function onFistLogin($strUserid) { if (class_module_system_aspect::getAspectByName("content") !== null) { $objDashboard = new class_module_dashboard_widget(); $objDashboard->setStrColumn("column3"); $objDashboard->setStrUser($strUserid); $objDashboard->setStrClass(__CLASS__); $objDashboard->setStrContent("a:2:{s:7:\"feedurl\";s:39:\"http://www.kajona.de/kajona_news_en.rss\";s:5:\"posts\";s:1:\"4\";}"); return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("content")->getSystemid())); } return true; }
/** * This callback is triggered on a users' first login into the system. * You may use this method to install a widget as a default widget to * a users dashboard. * * @param $strUserid * * @return bool */ public function onFistLogin($strUserid) { if (class_module_system_module::getModuleByName("stats") !== null && class_module_system_aspect::getAspectByName("management") !== null) { $objDashboard = new class_module_dashboard_widget(); $objDashboard->setStrColumn("column2"); $objDashboard->setStrUser($strUserid); $objDashboard->setStrClass(__CLASS__); $objDashboard->setStrContent("a:5:{s:7:\"current\";s:7:\"checked\";s:3:\"day\";s:7:\"checked\";s:4:\"last\";s:7:\"checked\";s:6:\"nrLast\";s:1:\"4\";s:5:\"chart\";s:7:\"checked\";}"); return $objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($strUserid, class_module_system_aspect::getAspectByName("management")->getSystemid())); } return true; }
private function updateDownloads() { echo "Updating downloads to new mediamanager structure...\n"; echo "<b>Please note: Permission-Settings can't be migrated. Please adopt the permissions, e.g. to download manually.</b>\n"; if (!in_array(_dbprefix_ . "downloads_archive", $this->objDB->getTables())) { echo "Downloads table missing, no update required.\n"; return true; } echo "Migrating old archives to new mediamanager repos...\n"; $strQuery = "SELECT * FROM " . _dbprefix_ . "downloads_archive"; $arrArchives = $this->objDB->getPArray($strQuery, array()); foreach ($arrArchives as $arrOneArchive) { //load foreign repo data $strQuery = "SELECT * FROM " . _dbprefix_ . "filemanager WHERE filemanager_foreign_id = ?"; $arrRepoData = $this->objDB->getPRow($strQuery, array($arrOneArchive["archive_id"])); echo "migrating old archive " . $arrOneArchive["archive_title"] . "\n"; echo " old path: " . $arrRepoData["filemanager_path"] . "\n"; //convert the path $strPath = $this->convertOldPath($arrRepoData["filemanager_path"]); echo " new path: " . $strPath . "\n"; $objRepo = new class_module_mediamanager_repo(); $objRepo->setStrPath($strPath); $objRepo->setStrTitle($arrOneArchive["archive_title"]); $objRepo->setStrViewFilter($arrRepoData["filemanager_view_filter"]); $objRepo->setStrUploadFilter($arrRepoData["filemanager_upload_filter"]); $objRepo->updateObjectToDb(); $objRepo->syncRepo(); echo "deleting old filemanager repo...\n"; $strQuery = "DELETE FROM " . _dbprefix_ . "filemanager WHERE filemanager_id = ?"; $this->objDB->_pQuery($strQuery, array($arrRepoData["filemanager_id"])); $this->deleteSystemRecord($arrRepoData["filemanager_id"]); echo "migrating downloads data...\n"; $this->updateDownloadsLevel($objRepo->getSystemid(), $arrOneArchive["archive_id"]); echo "updating existing downloads-elements...\n"; $strQuery = "UPDATE " . _dbprefix_ . "element_downloads SET download_id = ? WHERE download_id = ?"; $this->objDB->_pQuery($strQuery, array($objRepo->getSystemid(), $arrOneArchive["archive_id"])); echo "deleting downloads-toplist element...\n"; $objElement = class_module_pages_element::getElement("downloadstoplist"); if ($objElement != null) { $objElement->deleteObjectFromDatabase(); } echo "deleting old adminwidgets...\n"; $arrWidgets = class_module_dashboard_widget::getAllWidgets(); foreach ($arrWidgets as $objOneWidget) { if ($objOneWidget->getStrClass() == "class_adminwidget_downloads") { $objOneWidget->deleteObjectFromDatabase(); } } echo "deleting archive and contained downloads data...\n"; $this->deleteDownloadsLevel($arrOneArchive["archive_id"]); $this->objDB->_pQuery("DELETE FROM " . _dbprefix_ . "downloads_archive WHERE archive_id = ?", array($arrOneArchive["archive_id"])); $this->deleteSystemRecord($arrOneArchive["archive_id"]); } echo "Migrating old log-table...\n"; $this->objDB->_pQuery("INSERT INTO " . _dbprefix_ . "mediamanager_dllog SELECT * FROM " . _dbprefix_ . "downloads_log", array()); echo "Deleting downloads module...\n"; $this->removeModule("downloads"); $this->objDB->_pQuery("DROP TABLE " . _dbprefix_ . "downloads_archive", array()); $this->objDB->_pQuery("DROP TABLE " . _dbprefix_ . "downloads_file", array()); $this->objDB->_pQuery("DROP TABLE " . _dbprefix_ . "downloads_log", array()); $this->removeSetting("_downloads_suche_seite_"); return true; }
/** * Searches the root-node for a users' widgets. * If not given, the node is created on the fly. * Those nodes are required to ensure a proper sort-handling on the system-table * * @param string $strUserid * @param string $strAspectId * @return string * @static */ public static function getWidgetsRootNodeForUser($strUserid, $strAspectId = "") { if ($strAspectId == "") { $strAspectId = class_module_system_aspect::getCurrentAspectId(); } $strQuery = "SELECT system_id\n \t\t\t FROM " . _dbprefix_ . "dashboard,\n \t\t\t \t " . _dbprefix_ . "system\n \t\t\t WHERE dashboard_id = system_id\n \t\t\t AND system_prev_id = ?\n \t\t\t AND dashboard_user = ?\n \t\t\t AND dashboard_aspect = ?\n \t\t\t AND dashboard_class = ?\n \t ORDER BY system_sort ASC "; $arrRow = class_carrier::getInstance()->getObjDB()->getPRow($strQuery, array(class_module_system_module::getModuleByName("dashboard")->getSystemid(), $strUserid, $strAspectId, "root_node")); if (!isset($arrRow["system_id"]) || !validateSystemid($arrRow["system_id"])) { //Create a new root-node on the fly $objWidget = new class_module_dashboard_widget(); $objWidget->setStrAspect($strAspectId); $objWidget->setStrUser($strUserid); $objWidget->setStrClass("root_node"); $objWidget->updateObjectToDb(class_module_system_module::getModuleByName("dashboard")->getSystemid()); $strReturnId = $objWidget->getSystemid(); } else { $strReturnId = $arrRow["system_id"]; } return $strReturnId; }
/** * Creates the form to edit a widget (NOT the dashboard entry!) * * @throws class_exception * @return string "" in case of success * @permissions edit */ protected function actionEditWidget() { $strReturn = ""; $this->setArrModuleEntry("template", "/folderview.tpl"); if ($this->getParam("saveWidget") == "") { $objDashboardwidget = new class_module_dashboard_widget($this->getSystemid()); $objWidget = $objDashboardwidget->getConcreteAdminwidget(); //ask the widget to generate its form-parts and wrap our elements around $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref("dashboard", "editWidget")); $strReturn .= $objWidget->getEditForm(); $strReturn .= $this->objToolkit->formInputHidden("systemid", $this->getSystemid()); $strReturn .= $this->objToolkit->formInputHidden("saveWidget", "1"); $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("commons_save")); $strReturn .= $this->objToolkit->formClose(); } elseif ($this->getParam("saveWidget") == "1") { //the dashboard entry $objDashboardwidget = new class_module_dashboard_widget($this->getSystemid()); //the concrete widget $objConcreteWidget = $objDashboardwidget->getConcreteAdminwidget(); $objConcreteWidget->loadFieldsFromArray($this->getAllParams()); $objDashboardwidget->setStrContent($objConcreteWidget->getFieldsAsString()); if (!$objDashboardwidget->updateObjectToDb()) { throw new class_exception("Error updating widget to db!", class_exception::$level_ERROR); } $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "", "&peClose=1&blockAction=1")); } return $strReturn; }