示例#1
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     if (!isset($this->id)) {
         $ajaxResponseObject->setStatus("ok");
         $jswrapper = new \Widgets\JSWrapper();
         $ids = "";
         $elements = "";
         foreach ($this->elements as $key => $element) {
             if (count($this->elements) > $key + 1) {
                 $ids .= "{\"id\":\"" . $element->get_id() . "\", \"env\":\"" . $this->env . "\"}, ";
                 $elements .= "\"\", ";
             } else {
                 $ids .= "{\"id\":\"" . $element->get_id() . "\", \"env\":\"" . $this->env . "\"}";
                 $elements .= "\"\"";
             }
         }
         $js = "sendMultiRequest('Paste', jQuery.parseJSON('[{$ids}]'), jQuery.parseJSON('[{$elements}]'), 'updater', null, null, 'explorer', 'Füge Objekt ein ...', 0, " . count($this->elements) . ");";
         $jswrapper->setJs($js);
         $ajaxResponseObject->addWidget($jswrapper);
         return $ajaxResponseObject;
     } else {
         $ajaxResponseObject->setStatus("ok");
         $clipboardModel = new \Explorer\Model\Clipboard($this->clipboard);
         $jswrapper = new \Widgets\JSWrapper();
         $js = "document.getElementById('clipboardIconbarWrapper').innerHTML = '" . $clipboardModel->getIconbarHtml() . "';";
         if (count($this->clipboard->get_inventory()) == 0) {
             $js .= "window.location.reload();";
         }
         $jswrapper->setJs($js);
         $ajaxResponseObject->addWidget($jswrapper);
         return $ajaxResponseObject;
     }
 }
示例#2
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $ajaxResponseObject->setStatus("ok");
     $jswrapper = new \Widgets\JSWrapper();
     $clipboardModel = new \Explorer\Model\Clipboard($this->user);
     $js = "document.getElementById('clipboardIconbarWrapper').innerHTML = '" . $clipboardModel->getIconbarHtml() . "';";
     $jswrapper->setJs($js);
     $ajaxResponseObject->addWidget($jswrapper);
     return $ajaxResponseObject;
 }
示例#3
0
文件: Cut.class.php 项目: rolwi/koala
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $ajaxResponseObject->setStatus("ok");
     $jswrapper = new \Widgets\JSWrapper();
     $clipboardModel = new \Explorer\Model\Clipboard($this->user);
     $js = "\n\t\t if (jQuery('#explorerWrapper').length == 0) {\n\t\t\t   \tlocation.reload();\n\t\t\t   }\n\t\t else{\n\t\t       jQuery('#{$this->id}').remove();document.getElementById('clipboardIconbarWrapper').innerHTML = '" . $clipboardModel->getIconbarHtml() . "';\n\t\t\t}";
     $jswrapper->setJs($js);
     $ajaxResponseObject->addWidget($jswrapper);
     return $ajaxResponseObject;
 }
示例#4
0
 public function getIconBarEntries()
 {
     $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
     $trashbin = $currentUser->get_attribute(USER_TRASHBIN);
     $trashbinModel = new \Explorer\Model\Trashbin($trashbin);
     //$trashbinCount = count($trashbin->get_inventory());
     $trashbinCount = 1;
     $clipboardModel = new \Explorer\Model\Clipboard($currentUser);
     //$clipboardCount = count($currentUser->get_inventory());
     $clipboardCount = 1;
     return array(array("name" => "<div id=\"clipboardIconbarWrapper\">" . $clipboardModel->getIconbarHtml() . "</div>", "menu" => $clipboardCount > 0 ? array(array("name" => "Objekte hier einfügen", "onclick" => "sendRequest('Paste', {'env':jQuery('#environment').attr('value')}, '', 'popup', null, null, 'explorer');"), array("name" => "Zwischenablage leeren", "onclick" => "sendRequest('EmptyClipboard', {}, '', 'popup', null, null, 'explorer');")) : ""), array("name" => "<div id=\"trashbinIconbarWrapper\">" . $trashbinModel->getIconbarHtml() . "</div>", "menu" => $trashbinCount > 0 ? array(array("name" => "Papierkorb leeren", "onclick" => "sendRequest('EmptyTrashbin', {}, '', 'popup', null, null, 'explorer');"), array("name" => "Papierkorb öffnen")) : ""));
 }