예제 #1
0
 protected static function func(&$a)
 {
     if (array_key_exists('a_edited', $a)) {
         /**
          * A way to pass "translated"
          * version of "Edited" word
          * to the tplEditedby template
          */
         $aEdited = end($a['a_edited']);
         $a['edits'] = \tplEditedby::parse($aEdited);
     }
     if (!empty($a['i_sticky'])) {
         $a['sticky'] = ' sticky';
     }
     $a['hts'] = \Lampcms\TimeFormatter::formatTime($_SESSION['locale'], $a['i_ts']);
     if (!empty($a['a_comments'])) {
         /**
          * Closure function
          * to pass resource_id
          * and author id of this
          * Question to the tplComments
          * This way we don't have to store
          * duplicate data in each comment
          * element and still be able to
          * have access to these 2 important
          * fields in the tplComments template
          * We going to need id or resource owner
          * in order to add it to the "reply" link
          * in the form of class uid-$uid
          *
          */
         $rid = $a['_id'];
         $uid = $a['i_uid'];
         $f = function (&$data) use($rid, $uid) {
             $data['resource_id'] = $rid;
             $data['owner_id'] = $uid;
         };
         $a['comments_html'] = tplComment::loop($a['a_comments'], true, $f);
         //
     }
     if (!empty($a['pending'])) {
         $a['moderate'] = '<span class="cb fl pending">@@This question is pending moderator approval@@</span>';
         $a['approve'] = '<span class="ico ttt approve ajax" title="@@Approve this question@@"> </span>';
     }
 }
예제 #2
0
 protected static function func(&$a)
 {
     if (array_key_exists('a_edited', $a)) {
         /**
          * A way to pass "translated"
          * version of "Edited" word
          * to the tplEditedby template
          */
         $aEdited = end($a['a_edited']);
         $aEdited['edited'] = $a['edited'];
         $a['edits'] = \tplEditedby::parse($aEdited, false);
     }
     if (!empty($a['i_sticky'])) {
         $a['sticky'] = ' sticky';
     }
     if (!empty($a['a_comments'])) {
         /**
          * Closure function
          * to pass resource_id
          * and author id of this
          * Question to the tplComments
          * This way we don't have to store
          * duplicate data in each comment
          * element and still be able to
          * have access to these 2 important
          * fields in the tplComments template
          * We going to need id or resource owner
          * in order to add it to the "reply" link
          * in the form of class uid-$uid
          *
          */
         $rid = $a['_id'];
         $uid = $a['i_uid'];
         $reply = $a['reply'];
         $reply_t = $a['reply_t'];
         $f = function (&$data) use($rid, $uid, $reply, $reply_t) {
             $data['resource_id'] = $rid;
             $data['owner_id'] = $uid;
             $data['reply'] = $reply;
             $data['reply_t'] = $reply_t;
         };
         $a['comments_html'] = tplComment::loop($a['a_comments'], true, $f);
         //
     }
 }