예제 #1
0
 public function get_display($details = true, $jsbuttons = false)
 {
     $object = Shoutbox::get_object($this->object_type, $this->object_id);
     $object->format();
     $img = $this->get_image();
     $html = "<div class='shoutbox-item'>";
     $html .= "<div class='shoutbox-data'>";
     if ($details && $img) {
         $html .= "<div class='shoutbox-img'>" . $img . "</div>";
     }
     $html .= "<div class='shoutbox-info'>";
     if ($details) {
         $html .= "<div class='shoutbox-object'>" . $object->f_link . "</div>";
         $html .= "<div class='shoutbox-date'>" . date("Y/m/d H:i:s", $this->date) . "</div>";
     }
     $html .= "<div class='shoutbox-text'>" . $this->f_text . "</div>";
     $html .= "</div>";
     $html .= "</div>";
     $html .= "<div class='shoutbox-footer'>";
     if ($details) {
         $html .= "<div class='shoutbox-actions'>";
         if ($jsbuttons) {
             $html .= Ajax::button('?page=stream&action=directplay&playtype=' . $this->object_type . '&' . $this->object_type . '_id=' . $this->object_id, 'play', T_('Play'), 'play_' . $this->object_type . '_' . $this->object_id);
             $html .= Ajax::button('?action=basket&type=' . $this->object_type . '&id=' . $this->object_id, 'add', T_('Add'), 'add_' . $this->object_type . '_' . $this->object_id);
         }
         if (Access::check('interface', '25')) {
             $html .= "<a href=\"" . AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=" . $this->object_type . "&id=" . $this->object_id . "\">" . UI::get_icon('comment', T_('Post Shout')) . "</a>";
         }
         $html .= "</div>";
     }
     $html .= "<div class='shoutbox-user'>" . T_('by') . " ";
     if ($this->user > 0) {
         $user = new User($this->user);
         $user->format();
         if ($details) {
             $html .= $user->f_link;
         } else {
             $html .= $user->username;
         }
     } else {
         $html .= T_('Guest');
     }
     $html .= "</div>";
     $html .= "</div>";
     $html .= "</div>";
     return $html;
 }
예제 #2
0
 /**
  * load_latest_shout
  * This loads in the latest added shouts
  * @return array
  */
 public static function load_latest_shout()
 {
     $ids = Shoutbox::get_top(10);
     $results = array();
     foreach ($ids as $id) {
         $shout = new Shoutbox($id);
         $shout->format();
         $object = Shoutbox::get_object($shout->object_type, $shout->object_id);
         $object->format();
         $user = new User($shout->user);
         $user->format();
         $xml_array = array('title' => $user->username . ' ' . T_('on') . ' ' . $object->get_fullname(), 'link' => $object->link, 'description' => $shout->text, 'image' => Art::url($shout->object_id, $shout->object_type, null, 2), 'comments' => '', 'pubDate' => date("c", $shout->date));
         $results[] = $xml_array;
     }
     // end foreach
     return $results;
 }
?>
</th>
        <th class="cel_date"><?php 
echo T_('Date Added');
?>
</th>
        <th class="cel_action"><?php 
echo T_('Action');
?>
</th>
    </tr>
    <?php 
foreach ($object_ids as $shout_id) {
    $shout = new Shoutbox($shout_id);
    $shout->format();
    $object = Shoutbox::get_object($shout->object_type, $shout->object_id);
    $object->format();
    $client = new User($shout->user);
    $client->format();
    require AmpConfig::get('prefix') . '/templates/show_shout_row.inc.php';
    ?>
    <?php 
}
if (!count($object_ids)) {
    ?>
    <tr class="<?php 
    echo UI::flip_class();
    ?>
">
        <td colspan="6" class="error"><?php 
    echo T_('No Records Found');
예제 #4
0
파일: shout.php 프로젝트: axelsimon/ampache
 case 'add_shout':
     // Must be at least a user to do this
     if (!Access::check('interface', '25')) {
         UI::access_denied();
         exit;
     }
     if (!Core::form_verify('add_shout', 'post')) {
         UI::access_denied();
         exit;
     }
     $shout_id = Shoutbox::create($_POST);
     header("Location:" . AmpConfig::get('web_path'));
     break;
 case 'show_add_shout':
     // Get our object first
     $object = Shoutbox::get_object($_REQUEST['type'], $_REQUEST['id']);
     if (!$object || !$object->id) {
         Error::add('general', T_('Invalid Object Selected'));
         Error::display('general');
         break;
     }
     $object->format();
     if (strtolower(get_class($object)) == 'song') {
         $data = $_REQUEST['offset'];
     }
     // Now go ahead and display the page where we let them add a comment etc
     require_once AmpConfig::get('prefix') . '/templates/show_add_shout.inc.php';
     break;
 default:
     header("Location:" . AmpConfig::get('web_path'));
     break;
예제 #5
0
            <th class="cel_date"><?php 
echo T_('Date Added');
?>
</th>
            <th class="cel_action"><?php 
echo T_('Action');
?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
foreach ($object_ids as $shout_id) {
    $libitem = new Shoutbox($shout_id);
    $libitem->format();
    $object = Shoutbox::get_object($libitem->object_type, $libitem->object_id);
    $object->format();
    $client = new User($libitem->user);
    $client->format();
    require AmpConfig::get('prefix') . '/templates/show_shout_row.inc.php';
    ?>
        <?php 
}
if (!count($object_ids)) {
    ?>
        <tr class="<?php 
    echo UI::flip_class();
    ?>
">
            <td colspan="6" class="error"><?php 
    echo T_('No Records Found');