function getVideoIntro($videoIntroId = 0)
 {
     if ($videoIntroId > 0) {
         require_once PATH_CORE . '/classes/video.class.php';
         $videoTable = new VideoTable($this->db);
         $video = $videoTable->getRowObject();
         $video->load($videoIntroId);
         $str = '<div class="videoIntro">' . videos::buildPlayerFromLink($video->embedCode, 320, 240) . '</div><!-- end videoIntro -->';
         return $str;
     } else {
         return '';
     }
 }
 function buildIdeaDisplay($id = 0, $showShare = false)
 {
     $code = '';
     // display the idea
     $q = "SELECT Ideas.*,UserInfo.fbId,Tags.raw_tag as category FROM Ideas LEFT JOIN UserInfo ON Ideas.userid=UserInfo.userid LEFT JOIN Tags ON Ideas.tagid=Tags.id WHERE Ideas.id={$id};";
     $this->templateObj->db->result = $this->templateObj->db->query($q);
     $this->templateObj->db->setTemplateCallback('timeSince', array($this->utilObj, 'time_since'), 'dt');
     $this->templateObj->db->setTemplateCallback('category', array($this, 'cbIdeasTag'), 'tagid');
     $this->templateObj->db->setTemplateCallback('cmdLike', array($this, 'cbCommandLike'), 'id');
     //$this->templateObj->db->setTemplateCallback('showAnswer', array($this, 'cbShowAnswer'), 'id');
     $this->templateObj->db->setTemplateCallback('mbrLink', array($this->templateObj, 'buildLinkedProfileName'), array('fbId', 'false'));
     $this->templateObj->db->setTemplateCallback('mbrImage', array($this->templateObj, 'buildLinkedProfilePic'), array('fbId', 'normal'));
     $code .= $this->templateObj->mergeTemplate($this->templateObj->templates['ideaList'], $this->templateObj->templates['ideaItemDetail']);
     $code .= '<br />';
     $iTable = new ideasTable($this->db);
     $ir = $iTable->getRowObject();
     $ir->load($id);
     if ($ir->videoid != 0) {
         // display embedded video
         require_once PATH_CORE . '/classes/video.class.php';
         $videoTable = new VideoTable($this->db);
         $video = $videoTable->getRowObject();
         $video->load($ir->videoid);
         $code .= '<div id="readVideo">' . videos::buildPlayerFromLink($video->embedCode, 320, 240) . '<!-- end of readVideo --></div>';
     }
     $code .= '<div id="ideaShare" class="' . ($showShare ? '' : 'hidden') . '">';
     $temp = '<form requirelogin="******" id="idea_share_form" action="?p=ideas&o=view&id=' . $id . '" method="post"><p>To:<br /> <fb:multi-friend-input max="20" /></p><p class="bump10"><input class="btn_1" type="button" value="Send now" onclick="ideaShareSubmit(' . $id . ');return false;"></p></form>';
     $temp = '<div class="panelBar clearfix"><h2>Share this idea with your friends</h2></div><br />' . $temp;
     $temp = '<div class="panel_2 clearfix">' . $temp . '</div>';
     $code .= $temp . '</div><br />';
     // display the comments to this idea
     $comTemp = '<div id="ideaComments" >';
     $comTemp .= $this->buildCommentThread($id, false, $ir->numComments);
     $comTemp .= '</div><br />';
     $code .= '<div class="panel_2 clearfix"><div class="panelBar clearfix"><h2>Comments</h2><!-- end panelBar--></div><br />' . $comTemp . '<!-- end panel_2 --></div>';
     // display the link to this idea box
     $code .= $this->fetchLinkBox($ir);
     $code .= $this->fetchRelatedNews($ir);
     return $code;
 }
 function buildVideos($completedid)
 {
     //require_once(PATH_CORE.'/classes/challenges.class.php');
     require_once PATH_CORE . '/classes/video.class.php';
     $videoTable = new VideoTable($this->db);
     $video = $videoTable->getRowObject();
     $videoids = $videoTable->getVideosForCompletedChallenge($completedid);
     foreach ($videoids as $id) {
         if ($video->load($id)) {
             $code .= $this->buildVideoplayer($video->embedCode);
         }
     }
     return $code;
 }