/**
  * 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;
 }
 /**
  * saves the new position of a widget on the dashboard.
  * updates the sorting AND the assigned column
  *
  * @return string
  * @permissions edit
  */
 protected function actionSetDashboardPosition()
 {
     $strReturn = "";
     $objWidget = new class_module_dashboard_widget($this->getSystemid());
     $intNewPos = $this->getParam("listPos");
     $objWidget->setStrColumn($this->getParam("listId"));
     $objWidget->updateObjectToDb();
     class_carrier::getInstance()->getObjDB()->flushQueryCache();
     $objWidget = new class_module_dashboard_widget($this->getSystemid());
     if ($intNewPos != "") {
         $objWidget->setAbsolutePosition($intNewPos);
     }
     $strReturn .= "<message>" . $objWidget->getStrDisplayName() . " - " . $this->getLang("setDashboardPosition") . "</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_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;
 }
 /**
  * Generates the forms to add a widget to the dashboard
  *
  * @return string, "" in case of success
  * @autoTestable
  * @permissions edit
  */
 protected function actionAddWidgetToDashboard()
 {
     $strReturn = "";
     //step 1: select a widget, plz
     if ($this->getParam("step") == "") {
         $arrWidgetsAvailable = class_module_dashboard_widget::getListOfWidgetsAvailable();
         $arrDD = array();
         foreach ($arrWidgetsAvailable as $strOneWidget) {
             /** @var $objWidget interface_adminwidget|class_adminwidget */
             $objWidget = new $strOneWidget();
             $arrDD[$strOneWidget] = $objWidget->getWidgetName();
         }
         $arrColumnsAvailable = array();
         foreach ($this->arrColumnsOnDashboard as $strOneColumn) {
             $arrColumnsAvailable[$strOneColumn] = $this->getLang($strOneColumn);
         }
         $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref("dashboard", "addWidgetToDashboard"));
         $strReturn .= $this->objToolkit->formInputDropdown("widget", $arrDD, $this->getLang("widget"));
         $strReturn .= $this->objToolkit->formInputDropdown("column", $arrColumnsAvailable, $this->getLang("column"));
         $strReturn .= $this->objToolkit->formInputHidden("step", "2");
         $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("addWidgetNextStep"));
         $strReturn .= $this->objToolkit->formClose();
         $strReturn .= $this->objToolkit->setBrowserFocus("widget");
     } else {
         if ($this->getParam("step") == "2") {
             $strWidgetClass = $this->getParam("widget");
             /** @var class_adminwidget|interface_adminwidget $objWidget */
             $objWidget = new $strWidgetClass();
             if ($objWidget->getEditForm() == "") {
                 $this->adminReload(class_link::getLinkAdminHref("dashboard", "addWidgetToDashboard", "&step=3&widget=" . $strWidgetClass . "&column=" . $this->getParam("column")));
             } else {
                 //ask the widget to generate its form-parts and wrap our elements around
                 $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref("dashboard", "addWidgetToDashboard"));
                 $strReturn .= $objWidget->getEditForm();
                 $strReturn .= $this->objToolkit->formInputHidden("step", "3");
                 $strReturn .= $this->objToolkit->formInputHidden("widget", $strWidgetClass);
                 $strReturn .= $this->objToolkit->formInputHidden("column", $this->getParam("column"));
                 $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("commons_save"));
                 $strReturn .= $this->objToolkit->formClose();
             }
         } else {
             if ($this->getParam("step") == "3") {
                 //instantiate the concrete widget
                 $strWidgetClass = $this->getParam("widget");
                 /** @var class_adminwidget|interface_adminwidget $objWidget */
                 $objWidget = new $strWidgetClass();
                 //let it process its fields
                 $objWidget->loadFieldsFromArray($this->getAllParams());
                 //and save the dashboard-entry
                 $objDashboard = new class_module_dashboard_widget();
                 $objDashboard->setStrClass($strWidgetClass);
                 $objDashboard->setStrContent($objWidget->getFieldsAsString());
                 $objDashboard->setStrColumn($this->getParam("column"));
                 $objDashboard->setStrUser($this->objSession->getUserID());
                 $objDashboard->setStrAspect(class_module_system_aspect::getCurrentAspectId());
                 if ($objDashboard->updateObjectToDb(class_module_dashboard_widget::getWidgetsRootNodeForUser($this->objSession->getUserID(), class_module_system_aspect::getCurrentAspectId()))) {
                     $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul")));
                 } else {
                     return $this->getLang("errorSavingWidget");
                 }
             }
         }
     }
     return $strReturn;
 }