function CreateTable($array)
{
    $table_html = '';
    foreach ($array as $row) {
        $row_html = '';
        foreach ($row as $cell) {
            $row_html .= Tag('td', $cell);
        }
        $table_html .= Tag('tr', $row_html);
    }
    $html = Tag('table', $table_html);
    return $html;
}
Esempio n. 2
0
 function ModuleObject($config)
 {
     $this->MasterObject($config);
     $this->ModuleConfig = jconf::get('tag');
     $this->ID = (int) ($this->Get['id'] ? $this->Get['id'] : $this->Post['id']);
     $this->Item = isset($this->Get['item']) ? $this->Get['item'] : $this->Post['item'];
     if (false == isset($this->ModuleConfig['item_list'][$this->Item])) {
         $this->Item = $this->ModuleConfig['item_default'];
     }
     $this->ItemConfig = $this->ModuleConfig['item_list'][$this->Item];
     $this->ItemName = $this->ItemConfig['name'];
     $this->ItemUrl = $this->ItemConfig['url'];
     global $jishigou_rewrite;
     if ($jishigou_rewrite) {
         $this->ItemUrl = $jishigou_rewrite->formatURL($this->ItemUrl);
     }
     $this->TagLogic = Tag($this->Item);
     $this->TopicLogic = jlogic('topic');
     $this->CacheConfig = jconf::get('cache');
     $this->ShowConfig = jconf::get('show');
     $this->Execute();
 }
Esempio n. 3
0
 function writeTags($Discussion)
 {
     Gdn::controller()->fireEvent('BeforeDiscussionMeta');
     echo Tag($Discussion, 'Announce', 'Announcement');
     echo Tag($Discussion, 'Closed', 'Closed');
     Gdn::controller()->fireEvent('AfterDiscussionLabels');
 }
 /**
  * Allows user to close or re-open a discussion.
  *
  * If the discussion isn't closed, this closes it. If it is already
  * closed, this re-opens it. Closed discussions may not have new
  * comments added to them.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $DiscussionID Unique discussion ID.
  * @param bool $Close Whether or not to close the discussion.
  */
 public function Close($DiscussionID = '', $Close = TRUE, $From = 'list')
 {
     // Make sure we are posting back.
     if (!$this->Request->IsAuthenticatedPostBack()) {
         throw PermissionException('Javascript');
     }
     $Discussion = $this->DiscussionModel->GetID($DiscussionID);
     if (!$Discussion) {
         throw NotFoundException('Discussion');
     }
     $this->Permission('Vanilla.Discussions.Close', TRUE, 'Category', $Discussion->PermissionCategoryID);
     // Close the discussion.
     $this->DiscussionModel->SetField($DiscussionID, 'Closed', $Close);
     $Discussion->Closed = $Close;
     // Redirect to the front page
     if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
         $Target = GetIncomingValue('Target', 'discussions');
         SafeRedirect($Target);
     }
     $this->SendOptions($Discussion);
     if ($Close) {
         require_once $this->FetchViewLocation('helper_functions', 'Discussions');
         $this->JsonTarget(".Section-DiscussionList #Discussion_{$DiscussionID} .Meta-Discussion", Tag($Discussion, 'Closed', 'Closed'), 'Prepend');
         $this->JsonTarget(".Section-DiscussionList #Discussion_{$DiscussionID}", 'Closed', 'AddClass');
     } else {
         $this->JsonTarget(".Section-DiscussionList #Discussion_{$DiscussionID} .Tag-Closed", NULL, 'Remove');
         $this->JsonTarget(".Section-DiscussionList #Discussion_{$DiscussionID}", 'Closed', 'RemoveClass');
     }
     $this->JsonTarget("#Discussion_{$DiscussionID}", NULL, 'Highlight');
     $this->JsonTarget(".Discussion #Item_0", NULL, 'Highlight');
     $this->Render('Blank', 'Utility', 'Dashboard');
 }