Exemple #1
0
 /**
  * Renders the open questions table
  *
  * @param array $questions Array of open questions
  */
 public function renderOpenQuestions(array $questions)
 {
     global $PMF_LANG, $sids;
     $html = '';
     if (count($questions)) {
         foreach ($questions as $question) {
             if ($question->is_visible == 'N') {
                 continue;
             }
             $html .= '<tr class="openquestions">';
             $html .= sprintf('<td valign="top" nowrap="nowrap">%s<br /><a href="mailto:%s">%s</a></td>', PMF_Date::createIsoDate($question->date), PMF_Mail::safeEmail($question->email), $question->username);
             $html .= sprintf('<td valign="top"><strong>%s:</strong><br />%s</td>', $this->categoryLayout->renderBreadcrumb(array($question->category_id)), strip_tags($question->question));
             $html .= sprintf('<td valign="top"><a href="?%saction=add&amp;question=%d&amp;cat=%d">%s</a></td>', $sids, $question->id, $question->category_id, $PMF_LANG['msg2answer']);
             $html .= '</tr>';
         }
     } else {
         $output = sprintf('<tr><td colspan="3">%s</td></tr>', $PMF_LANG['msgNoQuestionsAvailable']);
     }
     return $html;
 }
Exemple #2
0
 /**
  * Returns all user comments (HTML formatted) from a record by type
  *
  * @todo Move this code to a helper class
  *
  * @param integer $id   Comment ID
  * @param integer $type Comment type: {faq|news}
  *
  * @return string
  */
 public function getComments($id, $type)
 {
     $comments = $this->getCommentsData($id, $type);
     $output = '';
     foreach ($comments as $item) {
         $output .= '<p class="comment">';
         $output .= '<img src="images/bubbles.gif" />';
         $output .= sprintf('<strong>%s<a href="mailto:%s">%s</a>:</strong><br />%s<br />%s</p>', $this->pmf_lang['msgCommentBy'], PMF_Mail::safeEmail($item['email']), $item['user'], nl2br($item['content']), $this->pmf_lang['newsCommentDate'] . PMF_Date::format(PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false)));
     }
     return $output;
 }
Exemple #3
0
 /**
  * Returns all user comments (HTML formatted) from a record by type
  *
  * @todo Move this code to a helper class
  *
  * @param integer $id   Comment ID
  * @param integer $type Comment type: {faq|news}
  *
  * @return string
  */
 public function getComments($id, $type)
 {
     $comments = $this->getCommentsData($id, $type);
     $date = new PMF_Date($this->config);
     $mail = new PMF_Mail($this->config);
     $output = '';
     foreach ($comments as $item) {
         $output .= '<p class="comment">';
         $output .= '<img class="commment-bubbles" src="assets/img/bubbles.gif" />';
         $output .= sprintf('<strong>%s<a href="mailto:%s">%s</a>:</strong><br />%s<br /><small>%s</small></p>', $this->pmfStr['msgCommentBy'], $mail->safeEmail($item['email']), $item['user'], $this->showShortComment($id, $item['content']), $this->pmfStr['newsCommentDate'] . $date->format(PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false)));
     }
     return $output;
 }
 /**
  * Prints the open questions as a XHTML table
  *
  * @return  string
  * @access  public
  * @since   2002-09-17
  * @author  Thorsten Rinne <*****@*****.**>
  */
 function printOpenQuestions()
 {
     global $sids, $category;
     $date = new PMF_Date($this->_config);
     $mail = new PMF_Mail($this->_config);
     $query = sprintf("\n            SELECT\n                COUNT(id) AS num\n            FROM\n                %sfaqquestions\n            WHERE\n                is_visible != 'Y'", PMF_Db::getTablePrefix());
     $result = $this->_config->getDb()->query($query);
     $row = $this->_config->getDb()->fetchObject($result);
     $numOfInvisibles = $row->num;
     if ($numOfInvisibles > 0) {
         $extraout = sprintf('<tr><td colspan="3"><small>%s %s</small></td></tr>', $this->pmf_lang['msgQuestionsWaiting'], $numOfInvisibles);
     } else {
         $extraout = '';
     }
     $query = sprintf("\n            SELECT\n                *\n            FROM\n                %sfaqquestions\n            WHERE\n                is_visible = 'Y'\n            ORDER BY\n                created ASC", PMF_Db::getTablePrefix());
     $result = $this->_config->getDb()->query($query);
     $output = '';
     if ($result && $this->_config->getDb()->numRows($result) > 0) {
         while ($row = $this->_config->getDb()->fetchObject($result)) {
             $output .= '<tr class="openquestions">';
             $output .= sprintf('<td><small>%s</small><br /><a href="mailto:%s">%s</a></td>', $date->format(PMF_Date::createIsoDate($row->created)), $mail->safeEmail($row->email), $row->username);
             $output .= sprintf('<td><strong>%s:</strong><br />%s</td>', isset($category->categoryName[$row->category_id]['name']) ? $category->categoryName[$row->category_id]['name'] : '', strip_tags($row->question));
             if ($this->_config->get('records.enableCloseQuestion') && $row->answer_id) {
                 $output .= sprintf('<td><a id="PMF_openQuestionAnswered" href="?%saction=artikel&amp;cat=%d&amp;id=%d">%s</a></td>', $sids, $row->category_id, $row->answer_id, $this->pmf_lang['msg2answerFAQ']);
             } else {
                 $output .= sprintf('<td><a class="btn btn-primary" href="?%saction=add&amp;question=%d&amp;cat=%d">%s</a></td>', $sids, $row->id, $row->category_id, $this->pmf_lang['msg2answer']);
             }
             $output .= '</tr>';
         }
     } else {
         $output = sprintf('<tr><td colspan="3">%s</td></tr>', $this->pmf_lang['msgNoQuestionsAvailable']);
     }
     return $output . $extraout;
 }
Exemple #5
0
 /**
  * Prints the open questions as a XHTML table
  *
  * @return  string
  * @access  public
  * @since   2002-09-17
  * @author  Thorsten Rinne <*****@*****.**>
  */
 function printOpenQuestions()
 {
     global $sids, $category;
     $query = sprintf("\n            SELECT\n                COUNT(*) AS num\n            FROM\n                %sfaqquestions\n            WHERE\n                is_visible != 'Y'", SQLPREFIX);
     $result = $this->db->query($query);
     $row = $this->db->fetch_object($result);
     $numOfInvisibles = $row->num;
     if ($numOfInvisibles > 0) {
         $extraout = sprintf('<tr><td colspan="3"><hr />%s%s</td></tr>', $this->pmf_lang['msgQuestionsWaiting'], $numOfInvisibles);
     } else {
         $extraout = '';
     }
     $query = sprintf("\n            SELECT\n                *\n            FROM\n                %sfaqquestions\n            WHERE\n                is_visible = 'Y'\n            ORDER BY\n                created ASC", SQLPREFIX);
     $result = $this->db->query($query);
     $output = '';
     if ($result && $this->db->num_rows($result) > 0) {
         while ($row = $this->db->fetch_object($result)) {
             $output .= '<tr class="openquestions">';
             $output .= sprintf('<td valign="top" nowrap="nowrap">%s<br /><a href="mailto:%s">%s</a></td>', PMF_Date::format(PMF_Date::createIsoDate($row->created)), PMF_Mail::safeEmail($row->email), $row->username);
             $output .= sprintf('<td valign="top"><strong>%s:</strong><br />%s</td>', isset($category->categoryName[$row->category_id]['name']) ? $category->categoryName[$row->category_id]['name'] : '', strip_tags($row->question));
             $output .= sprintf('<td valign="top"><a href="?%saction=add&amp;question=%d&amp;cat=%d">%s</a></td>', $sids, $row->id, $row->category_id, $this->pmf_lang['msg2answer']);
             $output .= '</tr>';
         }
     } else {
         $output = sprintf('<tr><td colspan="3">%s</td></tr>', $this->pmf_lang['msgNoQuestionsAvailable']);
     }
     return $output . $extraout;
 }
Exemple #6
0
 /**
 <<<<<<< HEAD
 =======
 * Prints the open questions as a XHTML table
 *
 * @return  string
 * @access  public
 * @since   2002-09-17
 * @author  Thorsten Rinne <*****@*****.**>
 */
 function printOpenQuestions()
 {
     global $sids, $category;
     if ($this->groupSupport) {
         $permPart = sprintf("AND ( fdg.group_id IN (%s))", implode(', ', $this->groups), $this->user, implode(', ', $this->groups));
         $permPartLeftJoin = sprintf("LEFT JOIN %sfaqcategory_group AS fdg ON fq.ask_rubrik = fdg.category_id", $SQLPREFIX);
     } else {
         $permPart = '';
         $permPartLeftJoin = '';
     }
     $query = sprintf("\n            SELECT\n                COUNT(*) AS num\n            FROM\n                %sfaqquestions \n\t\t\t%s\n            WHERE\n                is_visible != 'Y'\n\t\t\t%s ", SQLPREFIX, $permPartLeftJoin, $permPart);
     $result = $this->db->query($query);
     $row = $this->db->fetch_object($result);
     $numOfInvisibles = $row->num;
     if ($numOfInvisibles > 0) {
         $extraout = sprintf('<tr><td colspan="3"><hr />%s%s</td></tr>', $this->pmf_lang['msgQuestionsWaiting'], $numOfInvisibles);
     } else {
         $extraout = '';
     }
     $query = sprintf("\n            SELECT\n                fq.id,\n                fq.ask_username,\n                fq.ask_usermail,\n                fq.ask_rubrik,\n                fq.ask_content,\n                fq.ask_date\n            FROM\n                %sfaqquestions as fq\n            %s\n\t\t\tWHERE\n                fq.is_visible = 'Y'\n\t\t\t %s\n\t\t\tORDER BY\n                ask_date ASC", SQLPREFIX, $permPartLeftJoin, $permPart);
     $result = $this->db->query($query);
     $output = '';
     if ($this->db->num_rows($result) > 0) {
         while ($row = $this->db->fetch_object($result)) {
             $output .= '<tr class="openquestions">';
             $output .= sprintf('<td valign="top" nowrap="nowrap">%s<br /><a href="mailto:%s">%s</a></td>', PMF_Date::createIsoDate($row->created), PMF_Mail::safeEmail($row->email), $row->username);
             $output .= sprintf('<td valign="top"><strong>%s:</strong><br />%s</td>', isset($category->categoryName[$row->category_id]['name']) ? $category->categoryName[$row->category_id]['name'] : '', strip_tags($row->question));
             $output .= sprintf('<td valign="top"><a href="?%saction=add&amp;question=%d&amp;cat=%d">%s</a></td>', $sids, $row->id, $row->category_id, $this->pmf_lang['msg2answer']);
             $output .= '</tr>';
         }
     } else {
         $output = sprintf('<tr><td colspan="3">%s</td></tr>', $this->pmf_lang['msgNoQuestionsAvailable']);
     }
     return $output . $extraout;
 }