<?php echo Icon::create('checkbox-checked', 'info')->asImg(['class' => "check text-bottom"]); ?> </div> <input type="checkbox" name="filter_nohashtags_check" id="filter_nohashtags_check" onChange="jQuery(this).closest('td').toggleClass('selected');" value="1"<?php echo $stream['filter_nohashtags'] ? " checked" : ""; ?> > </td> </tr> </tbody> </table> <?php echo \Studip\Button::createAccept(_("Speichern"), array()); ?> </form> <?php $sidebar = Sidebar::get(); $sidebar->setImage("sidebar/blubber-sidebar.png"); $streamAvatar = StreamAvatar::getAvatar($stream->getId()); if ($streamAvatar->is_customized()) { $sidebar->setContextAvatar($streamAvatar); } $actions = new ActionsWidget(); if (!$stream->isNew()) { $actions->addLink(_("Diesen Stream löschen"), PluginEngine::getURL($plugin, array(), 'streams/delete/' . $stream->getId()), Icon::create("trash", "clickable"), array('onclick' => "return window.confirm('" . _("Wirklich löschen?") . "');")); } $sidebar->addWidget($actions);
/** * Create a new or edit an existing stream. * @param string,null $stream_id */ public function edit_action($stream_id = null) { $this->stream = new BlubberStream($stream_id); if ($GLOBALS['user']->id === "nobody") { throw new AccessDeniedException(); } if ($stream_id) { Navigation::activateItem("/community/blubber/" . $stream_id); } if ($this->stream['user_id'] && $this->stream['user_id'] !== $GLOBALS['user']->id) { throw new AccessDeniedException("Not allowed to edit stream"); } $this->contact_groups = DBManager::get()->query("SELECT statusgruppen.* " . "FROM statusgruppen " . "WHERE statusgruppen.range_id = " . DBManager::get()->quote($GLOBALS['user']->id) . " " . "ORDER BY name ASC " . "")->fetchAll(PDO::FETCH_ASSOC); if (Request::isPost()) { $new = $this->stream->isNew(); $this->stream['name'] = Request::get("name"); $this->stream['user_id'] = $GLOBALS['user']->id; $this->stream['sort'] = Request::get("sort"); $this->stream['defaultstream'] = Request::int("defaultstream"); //Pool-rules $this->stream['pool_courses'] = Request::get("pool_courses_check") ? in_array("all", Request::getArray("pool_courses")) ? array("all") : Request::getArray("pool_courses") : null; $this->stream['pool_groups'] = Request::get("pool_groups_check") ? in_array("all", Request::getArray("pool_groups")) ? array("all") : Request::getArray("pool_groups") : null; $this->stream['pool_hashtags'] = Request::get("pool_hashtags_check") ? preg_split("/\\s+/", Request::get("pool_hashtags"), null, PREG_SPLIT_NO_EMPTY) : null; if (is_array($this->stream['pool_hashtags'])) { $this->stream['pool_hashtags'] = array_map(function ($tag) { while ($tag[0] === "#") { $tag = substr($tag, 1); } return $tag; }, $this->stream['pool_hashtags']); } //Filter-rules $this->stream['filter_type'] = Request::get("filter_type_check") ? Request::getArray("filter_type") : null; $this->stream['filter_courses'] = Request::get("filter_courses_check") ? in_array("all", Request::getArray("filter_courses")) ? array("all") : Request::getArray("filter_courses") : null; $this->stream['filter_groups'] = Request::get("filter_groups_check") ? in_array("all", Request::getArray("filter_groups")) ? array("all") : Request::getArray("filter_groups") : null; $this->stream['filter_hashtags'] = Request::get("filter_hashtags_check") ? preg_split("/\\s+/", Request::get("filter_hashtags"), null, PREG_SPLIT_NO_EMPTY) : null; if (is_array($this->stream['filter_hashtags'])) { $this->stream['filter_hashtags'] = array_map(function ($tag) { while ($tag[0] === "#") { $tag = substr($tag, 1); } return $tag; }, $this->stream['filter_hashtags']); } $this->stream['filter_nohashtags'] = Request::get("filter_nohashtags_check") ? preg_split("/\\s+/", Request::get("filter_nohashtags"), null, PREG_SPLIT_NO_EMPTY) : null; if (is_array($this->stream['filter_nohashtags'])) { $this->stream['filter_nohashtags'] = array_map(function ($tag) { while ($tag[0] === "#") { $tag = substr($tag, 1); } return $tag; }, $this->stream['filter_nohashtags']); } $this->stream->store(); if ($_FILES['image']['size']) { StreamAvatar::getAvatar($this->stream->getId())->createFromUpload("image"); } if ($new) { $this->redirect(PluginEngine::getURL($this->plugin, array(), "streams/custom/" . $this->stream->getId())); } else { PageLayout::postMessage(MessageBox::success(_("Stream wurde gespeichert."))); } } }