Пример #1
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $idRequestObject = new \IdRequestObject();
     $idRequestObject->setId($this->id);
     $extensions = \ExtensionMaster::getInstance()->getExtensionByType("IObjectExtension");
     $commands = array();
     foreach ($extensions as $extension) {
         if (strstr(strtolower(get_class($extension)), "portlet")) {
             $command = $extension->getCreateNewCommand($idRequestObject);
             if ($command) {
                 $commands[] = $command;
             }
         }
     }
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Erstelle ein neues Objekt in Spalte " . $object->get_name());
     $dialog->setCloseButtonLabel(null);
     $dialog->setPositionX($this->params["mouseX"]);
     $dialog->setPositionY($this->params["mouseY"]);
     $html = "<div id=\"wizard\" style=\"margin-left: 20px; margin-right: 20px\">";
     foreach ($commands as $command) {
         $namespaces = $command->getExtension()->getUrlNamespaces();
         $html .= "<a href=\"\" onclick=\"sendRequest('{$command->getCommandName()}', {'id':{$this->id}}, 'wizard', 'wizard', null, null, '{$namespaces[0]}');return false;\" title=\"{$command->getExtension()->getObjectReadableDescription()}\"><img src=\"{$command->getExtension()->getObjectIconUrl()}\"> {$command->getExtension()->getObjectReadableName()}</a><br>";
     }
     $html .= "<div style=\"float:right\"><a class=\"button pill negative\" onclick=\"closeDialog();return false;\" href=\"#\">Abbrechen</a></div></div><div id=\"wizard_wrapper\"></div>";
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($html);
     $dialog->addWidget($rawHtml);
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($dialog);
     return $ajaxResponseObject;
 }
Пример #2
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $idRequestObject = new \IdRequestObject();
        $idRequestObject->setId($this->id);
        $columnObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        foreach ($GLOBALS["STEAM"]->get_current_steam_user()->get_inventory() as $steamObject) {
            $portletType = $steamObject->get_attribute("bid:portlet");
            $isPortlet = false;
            if ($portletType != 0) {
                switch ($portletType) {
                    case "msg":
                        $isPortlet = true;
                        break;
                    case "appointment":
                        $isPortlet = true;
                        break;
                    case "termplan":
                        $isPortlet = true;
                        break;
                    case "topic":
                        $isPortlet = true;
                        break;
                    case "headline":
                        $isPortlet = true;
                        break;
                    case "poll":
                        $isPortlet = true;
                        break;
                    case "media":
                        $isPortlet = true;
                        break;
                    case "rss":
                        $isPortlet = true;
                        break;
                    default:
                        $isPortlet = false;
                        break;
                }
            }
            if ($isPortlet) {
                $steamObject->move($columnObject);
            }
        }
        $ajaxResponseObject->setStatus("ok");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\twindow.location.reload();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Пример #3
0
 public function getWidgetsByObjectId($objectId, $method = "view", $params = array())
 {
     $idRequestObject = new IdRequestObject();
     $idRequestObject->setId($objectId);
     $idRequestObject->setMethod($method);
     $idRequestObject->setParams($params);
     $command = $this->getCommandByObjectId($objectId, $method);
     if ($command instanceof IIdCommand) {
         if ($command->validateData($idRequestObject)) {
             $command->processData($idRequestObject);
             $idResponseObject = $command->idResponse(new IdResponseObject());
             if ($idResponseObject == null) {
                 throw new Exception("idResponseObject is null for command " . get_class($command));
             }
             return $idResponseObject->getWidgets();
         } else {
             throw new Exception("Command validation error for {$objectId}.");
         }
     }
     return "";
 }