Exemplo n.º 1
0
 /**
  * Добавляет трэк в redis
  *
  * @param Tracks $track
  * @return int
  */
 public function addTrack(Tracks $track)
 {
     if ($track->getIsNewRecord()) {
         $track->id = $this->redis()->incr(self::KEY_SEQUENCE);
     }
     $attrs = $track->getAttributes();
     foreach ($attrs as $k => $v) {
         if ($v === null) {
             unset($attrs[$k]);
         }
     }
     $this->redis()->hMset($this->getTrackKey($track->id), $attrs);
     return $track->id;
 }
Exemplo n.º 2
0
function sidebar()
{
    $return .= "\n\t<h4>Music Library</h4>\n\t<dl>\n\t\t<dt>Tracks</dt>\n\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\n\t\t<dt>Artists</dt>\n\t\t<dd>" . number_format(Artists::count()) . "</dd>\n\t\t<dt>Albums</dt>\n\t\t<dd>" . number_format(Albums::count()) . "</dd>\n\t</dl>";
    function bytes($a)
    {
        $unim = array("B", "KB", "MB", "GB", "TB", "PB");
        $c = 0;
        while ($a >= 1024) {
            $c++;
            $a = $a / 1024;
        }
        return number_format($a, $c ? 2 : 0, ".", ",") . " " . $unim[$c];
    }
    $return .= "\n\t<h4>Archive Storage</h4>\n\t<dl>";
    foreach (Archives::get_all() as $archive) {
        $pc = (int) (100 - $archive->get_free_space() / $archive->get_total_space() * 100);
        if ($archive->get_free_space() > 536870912000.0) {
            $colour = "success";
        } else {
            if ($archive->get_free_space() > 214748364800.0) {
                $colour = "warning";
            } else {
                $colour = "danger";
            }
        }
        $return .= "\n\t\t<dt>" . $archive->get_name() . "</dt>\n\t\t<dd><div class=\"progress\" style=\"margin: 3px 0px; \"><div class=\"progress-bar progress-bar-" . $colour . "\" style=\"width: " . $pc . "%;\"></div></div></dd>\n\t\t<dd>" . bytes($archive->get_free_space()) . " free of " . bytes($archive->get_total_space()) . "</dd>";
    }
    $return .= "</dl>";
    return $return;
}
Exemplo n.º 3
0
 public function actionByid($id, $student = null)
 {
     $course = Courses::model()->findByPk($id);
     $tracks = Tracks::model()->with(array('Tasks.Solutions' => array('on' => 'Solutions.student=' . $_SESSION['user'])))->findAllByAttributes(array("course" => $course->id), array('order' => 't.order'));
     $this->render('single', array("course" => $course, "tracks" => $tracks));
 }
Exemplo n.º 4
0
<?php

$track = Tracks::get_by_id($_REQUEST["id"]);
if ($_REQUEST["flag"]) {
    if ($track->is_flagged()) {
        $track->set_flagged(false);
        $response = "unflagged";
    } else {
        $track->set_flagged(true);
        $response = "flagged";
    }
}
$result = $track->save();
if (Errors::occured()) {
    http_response_code(400);
    exit(json_encode(array("error" => "Something went wrong. You may have discovered a bug!", "detail" => Errors::report("array"))));
}
exit(json_encode(array("response" => $response)));
Exemplo n.º 5
0
<?php

if (isset($_REQUEST['refer']) && Session::is_user()) {
    $refer = preg_replace('/\\&/', '?', $_REQUEST["refer"], 1);
    header("Location: " . LINK_ABS . $refer);
}
MainTemplate::set_feature_image(LINK_ABS . "img/homepage.png");
echo "\n\t\t<script type=\"text/javascript\">\n\t\t\$(function () {\n\t\t\t\$('#username').focus();\n\t\t\t\$('.form-signin').submit(function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t\$('#submit').button('loading');\n\t\t\t\t\$('.help-inline').remove();\n\t\t\t\t\$.post('ajax/login.php', \$(this).serialize(), function(data) {\n\t\t\t\t\tif(data == \"success\") { \n\t\t\t\t\t\tlocation.reload()\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\$('#submit').after('<span class=\"help-inline\">'+data+'</span>');\n\t\t\t\t\t\t\$('#submit').button('reset');\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t});\n\t\t});\n\t\t</script>";
$feature = "\n\t\t\t<div class=\"row\">\n\t\t\t\t<div class=\"col-sm-8\">\n\t\t\t\t\t<h1>Digiplay <small>by Radio Warwick</small></h1>\n\t\t\t\t\t<p>A magical software suite run by miniature elves, which is amazing because elves are already very small by their nature.</p>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t" . (Session::is_user() ? "\n\t\t\t\t\t<h2>Common Tasks</h2>\n\t\t\t\t\t<a href=\"music/upload/\" class=\"btn btn-primary btn-large btn-block\">Upload Audio &raquo;</a>\n\t\t\t\t\t<a href=\"playlists/\" class=\"btn btn-primary btn-large btn-block\">Edit Playlists &raquo;</a>\n\t\t\t\t\t<a href=\"sustainer/\" class=\"btn btn-primary btn-large btn-block\">Schedule Prerecorded Content &raquo;</a>\n\t\t\t\t\t<a href=\"faults/\" class=\"btn btn-primary btn-large btn-block\">Report a Fault &raquo;</a>\n\t\t\t\t\t" . (Session::is_group_user("Studio Admin") ? "<a href=\"reset.php\" class=\"btn btn-primary btn-large btn-block\">Reset Playout Systems &raquo;</a>" : "") . "\n\t\t\t\t" : "\n\t\t\t\t\t<form class=\"form-signin\" action=\"ajax/login.php\" method=\"post\">\n\t\t\t\t\t\t<div class=\"form-group" . (isset($_REQUEST['refer']) ? " has-error" : "") . "\">\n\t\t\t\t\t\t\t<input id=\"username\" name=\"username\" type=\"text\" class=\"form-control input-lg\" placeholder=\"Username\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"form-group" . (isset($_REQUEST['refer']) ? " has-error" : "") . "\">\n\t\t\t\t\t\t\t<input id=\"password\" name=\"password\" type=\"password\" class=\"form-control input-lg\" placeholder=\"Password\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t\t<input type=\"submit\" class=\"btn btn-lg " . (isset($_REQUEST['refer']) ? "btn-danger" : "btn-primary") . " btn-block\" id=\"submit\" name=\"submit\" value=\"Log In\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t") . "\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t";
MainTemplate::set_feature_html($feature);
echo "<div class=\"row\">\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<h2>Music Library</h2>\n\t\t\t\t<dl>\n\t\t\t\t\t<dt>Tracks Stored</dt>\n\t\t\t\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\n\t\t\t\t\t<dt>Length of Tracks</dt>\n\t\t\t\t\t<dd>" . Time::format_pretty(Tracks::get_total_length()) . "</dd>\n\t\t\t\t\t<dt>Playlisted Tracks</dt>\n\t\t\t\t\t<dd>" . (count(Tracks::get_playlisted()) - count(Tracks::get_playlisted(Playlists::get(0)))) . "</dd>\n\t\t\t\t</dl>\n\t\t\t</div>\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<h2>Sustainer Service</h2>\n\t\t\t\t<dl>\n\t\t\t\t\t<dt>Tracks on Sustainer</dt>\n\t\t\t\t\t<dd>" . Sustainer::get_total_tracks() . "</dd>\n\t\t\t\t\t<dt>Length of Sustainer Playlist</dt>\n\t\t\t\t\t<dd>" . Sustainer::get_total_length_formatted() . "</dd>\n\t\t\t\t</dl>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "sustainer/\">" . Bootstrap::glyphicon("headphones") . "Now playing</a>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "playlists/detail/0\">" . Bootstrap::glyphicon("list") . "View playlist</a>\n\t\t\t</div>\n\t\t\t<div class=\"col-sm-4\">\n\t\t\t\t<h2>Newest Tracks</h2>";
$tracks = Tracks::get_newest(4);
echo "<table class=\"table table-striped table-hover table-condensed\" cellspacing=\"0\">";
foreach ($tracks as $track) {
    echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=\"icon\">\n\t\t\t\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\n\t\t\t\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class=\"title\">" . $track->get_title() . " by " . $track->get_artists_str() . "</td>\n\t\t\t\t\t</tr>";
}
echo "\n\t\t\t\t</table>\n\t\t\t\t<a class=\"btn btn-primary btn-block\" href=\"" . LINK_ABS . "music/\">" . Bootstrap::glyphicon("chevron-right") . "More</a>\n\t\t\t</div>\n\t\t</div>";
if (Session::is_user()) {
    $lastlogin = Session::get_lastlogin();
    if ($lastlogin) {
        echo "<p class=\"text-success\">You last logged in: " . strftime("%A %e %B %G %H:%M", $lastlogin) . "</p>";
    } else {
        echo "<p class=\"text-success\">You've never logged in before! Welcome to the Digiplay Web Management System.</p>";
    }
    echo "<h4>Tracks of the Day:</h4><ul>";
    $tracks = Tracks::get_tracks_of_the_day(3);
    foreach ($tracks as $track) {
        echo "<li><a href=\"music/detail/" . $track->get_id() . "\">" . $track->get_artists_str() . " - " . $track->get_title() . "</a></li>";
    }
    echo "</ul>";
}
Exemplo n.º 6
0
		</div>

		<div class="col-md-6"> 
			<label for="">Подзаголовок</label>
			<?php 
echo $form->textField($algorithm, 'description', array("class" => "form-control"));
?>
	

		</div>

		<div class="col-md-3"> 
			<label for="">Трек</label>

			<?php 
echo $form->dropDownList($algorithm, 'Tracks', CHtml::listData(Tracks::model()->findAll(), 'id', 'title'), array('class' => 'form-control', "multiple" => true));
?>

	 		</div>

	</div>
 

	<hr>

	<?php 
$steps = json_decode($algorithm->steps, true);
?>


Exemplo n.º 7
0
<?php

Output::set_template();
$audio = Tracks::get($_GET["id"]);
$filetypes = array("mp3" => "audio/mpeg");
if (array_key_exists($_GET["filetype"], $filetypes)) {
    $filetype = $_GET["filetype"];
    $mimetype = $filetypes[$_GET["filetype"]];
} else {
    exit(http_response_code(400));
}
if (!Session::is_group_user("Music Admin")) {
    parse_str(substr($_SERVER["HTTP_REFERER"], strpos($_SERVER["HTTP_REFERER"], "?") + 1), $parameters);
    if (is_null(Locations::get_by_key($_REQUEST["key"]))) {
        exit(http_response_code(401));
    }
}
if (Session::is_group_user("Music Admin")) {
    $multi = 24;
    $bitrate = "192";
} else {
    $multi = 6;
    $bitrate = "48";
}
header("Content-type: " . $filetype);
header('Content-Length: ' . $multi * 1000 * $audio->get_length());
header("accept-ranges: bytes");
if (Session::is_group_user("Music Admin")) {
    $multi = 24;
    $bitrate = "192";
} else {
Exemplo n.º 8
0
 if (isset($_REQUEST["search-album"]) && $_REQUEST["search-album"] == "on") {
     $index[] = "album";
 }
 $search_limit = Configs::get_system_param("search_limit");
 if ($query && count($index) >= 1) {
     $search = Search::tracks($query, $index, $search_limit);
 }
 if (isset($search)) {
     $return = "<table class=\"table table-hover\" cellspacing=\"0\">\r\n\t\t\t\t<thead>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th class=\"icon\"></th>\r\n\t\t\t\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t\t\t\t<th class=\"title\">Title</th>\r\n\t\t\t\t\t\t<th class=\"album\">Album</th>\r\n\t\t\t\t\t\t<th class=\"length\">Length</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</thead>\r\n\t\t\t\t<tbody>";
     if (Configs::get_system_param("censor_start") < date("H") && date("H") < Configs::get_system_param("censor_end")) {
         $censor_time = true;
     } else {
         $censor_time = false;
     }
     foreach ($search["results"] as $track) {
         $track = Tracks::get($track);
         $lastLogged = LogItems::get_by_audioid($track->get_id());
         $trackHotness = "";
         // default at 0
         if (isset($lastLogged)) {
             $lastPlay = $lastLogged->get_datetime();
             if ($lastPlay > time() - 604800) {
                 $trackHotness = "active";
             }
             // 1 week
             if ($lastPlay > time() - 86400) {
                 $trackHotness = "info";
             }
             // 24 hours
             if ($lastPlay > time() - 10800) {
                 $trackHotness = "success";
Exemplo n.º 9
0
 /**
  * Group::getNewGroupsXml()
  * @desc     Создаёт xml с новыми исполнителями
  * @param \DOMElement $node
  * @param integer $limit
  * @param bool $trackCountFilter - если true то в выводе будут только группы с треками.
  * @internal param bool $fanGroup - фильтр по фангруппам 0 - без фангрупп, 1 - с фангруппами
  * @return void
  */
 public static function getNewGroupsXml($node, $limit = 15, $trackCountFilter = true)
 {
     $db = Difra\MySQL::getInstance();
     $limitString = '';
     if ($limit != 0) {
         $limitString = ' LIMIT ' . intval($limit);
     }
     $res = $db->fetch("SELECT g.*\n\t\t\t\t\tFROM `groups` g\n\t\t\t\t\tORDER BY g.`id` DESC" . $limitString);
     if (!empty($res)) {
         $groupsIdArray = [];
         foreach ($res as $data) {
             $groupsIdArray[] = $data['id'];
         }
         // TODO: Tracks не должно же быть в плагине
         $tracksCount = \Tracks::getInstance()->getTracksCount($groupsIdArray);
         if (!empty($tracksCount)) {
             /** @var \DOMElement $newGroupsXml */
             $newGroupsXml = $node->appendChild($node->ownerDocument->createElement('newGroups'));
             $newGroupsXml->setAttribute('limit', $limit);
             foreach ($res as $data) {
                 if ($trackCountFilter) {
                     if (isset($tracksCount[$data['id']]['tracks_count']) && $tracksCount[$data['id']]['tracks_count'] != 0) {
                         /** @var \DOMElement $groupItemXml */
                         $groupItemXml = $newGroupsXml->appendChild($node->ownerDocument->createElement('group'));
                         foreach ($data as $key => $value) {
                             $groupItemXml->setAttribute($key, $value);
                         }
                         $groupItemXml->setAttribute('tracks_count', $tracksCount[$data['id']]['tracks_count']);
                     }
                 } else {
                     $tCount = 0;
                     $groupItemXml = $newGroupsXml->appendChild($node->ownerDocument->createElement('group'));
                     foreach ($data as $key => $value) {
                         $groupItemXml->setAttribute($key, $value);
                     }
                     if (isset($tracksCount[$data['id']]['tracks_count'])) {
                         $tCount = intval($tracksCount[$data['id']]['tracks_count']);
                     }
                     $groupItemXml->setAttribute('tracks_count', $tCount);
                 }
             }
         }
     }
 }
Exemplo n.º 10
0
<?php

Output::set_title("Administration");
MainTemplate::set_subtitle("Control every aspect of the Digiplay system");
$trash = Files::get_by_id(3, "dir");
echo "\n<div class=\"row\">\n\t<div class=\"col-sm-4\">\n\t\t<a href=\"" . LINK_ABS . "admin/music\">\n\t\t\t<div class=\"panel panel-info\">\n\t\t\t\t<div class=\"panel-heading\">\n\t\t\t\t\t<div class=\"row dashboard-stamp\">\n\t\t\t\t\t\t<div class=\"col-xs-5\">\n\t\t\t\t\t\t\t" . Bootstrap::glyphicon("volume-up icon-huge") . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"col-xs-7\">\n\t\t\t\t\t\t\t<h2>" . Tracks::get_total_tracks() . "</h2>\n\t\t\t\t\t\t\t<h4>tracks</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</a>\n\t</div>\n\t<div class=\"col-sm-4\">\n\t\t<a href=\"" . LINK_ABS . "admin/users\">\n\t\t\t<div class=\"panel panel-success\">\n\t\t\t\t<div class=\"panel-heading\">\n\t\t\t\t\t<div class=\"row dashboard-stamp\">\n\t\t\t\t\t\t<div class=\"col-xs-5\">\n\t\t\t\t\t\t\t" . Bootstrap::glyphicon("user icon-huge") . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"col-xs-7\">\n\t\t\t\t\t\t\t<h2>" . Users::count() . "</h2>\n\t\t\t\t\t\t\t<h4>users</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</a>\n\t</div>\n\t<div class=\"col-sm-4\">\n\t\t<a href=\"" . LINK_ABS . "showplans\">\n\t\t\t<div class=\"panel panel-default\">\n\t\t\t\t<div class=\"panel-heading\">\n\t\t\t\t\t<div class=\"row dashboard-stamp\">\n\t\t\t\t\t\t<div class=\"col-xs-5\">\n\t\t\t\t\t\t\t" . Bootstrap::glyphicon("tasks icon-huge") . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"col-xs-7\">\n\t\t\t\t\t\t\t<h2>" . Showplans::count() . "</h2>\n\t\t\t\t\t\t\t<h4>showplans</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</a>\n\t</div>\n</div>\n<div class=\"row\">\n\t<div class=\"col-sm-4\">\n\t\t<a href=\"" . LINK_ABS . "audiowalls\">\n\t\t\t<div class=\"panel panel-default\">\n\t\t\t\t<div class=\"panel-heading\">\n\t\t\t\t\t<div class=\"row dashboard-stamp\">\n\t\t\t\t\t\t<div class=\"col-xs-5\">\n\t\t\t\t\t\t\t" . Bootstrap::glyphicon("th icon-huge\" style=\"margin-top: -4px;") . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"col-xs-7\">\n\t\t\t\t\t\t\t<h2>" . AudiowallSets::count() . "</h2>\n\t\t\t\t\t\t\t<h4>audiowalls</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</a>\n\t</div>\n\t<div class=\"col-sm-4\">\n\t\t<a href=\"" . LINK_ABS . "email\">\n\t\t\t<div class=\"panel panel-warning\">\n\t\t\t\t<div class=\"panel-heading\">\n\t\t\t\t\t<div class=\"row dashboard-stamp\">\n\t\t\t\t\t\t<div class=\"col-xs-5\">\n\t\t\t\t\t\t\t" . Bootstrap::glyphicon("envelope icon-huge") . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"col-xs-7\">\n\t\t\t\t\t\t\t<h2>" . Emails::count_unread() . "</h2>\n\t\t\t\t\t\t\t<h4>e-mails</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</a>\n\t</div>\n\t<div class=\"col-sm-4\">\n\t\t<a href=\"" . LINK_ABS . "admin/trash\">\n\t\t\t<div class=\"panel panel-danger\">\n\t\t\t\t<div class=\"panel-heading\">\n\t\t\t\t\t<div class=\"row dashboard-stamp\">\n\t\t\t\t\t\t<div class=\"col-xs-5\">\n\t\t\t\t\t\t\t" . Bootstrap::glyphicon("trash icon-huge") . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"col-xs-7\">\n\t\t\t\t\t\t\t<h2>" . $trash->count() . "</h2>\n\t\t\t\t\t\t\t<h4>in trash</h4>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</a>\n\t</div>\n</div>";
Exemplo n.º 11
0
		
		<!-- Быстрый переход к прогрессу -->

</td><td>

		<div class="btn-group pull-right ">

			<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
				Выберите тему<span class="caret"></span>
			</button>

			<ul class="dropdown-menu " role="menu">


				<?php 
foreach (Tracks::model()->findAllByAttributes(array("course" => $data->course)) as $item) {
    ?>
				
						<li>

							<a href="/groups/<?php 
    echo $data->id;
    ?>
/progress/<?php 
    echo $item->id;
    ?>
">
								<?php 
    echo $item->title;
    ?>
							</a> 
Exemplo n.º 12
0
 public function get_tracks($limit = 0, $offset = 0)
 {
     return Tracks::get_playlisted($this, $limit, $offset);
 }
Exemplo n.º 13
0
 public function actionTheory($id)
 {
     $track = Tracks::model()->with("Tasks")->findByPk($id);
     $tasks = Tasks::model()->findAllByAttributes(array("track" => $id), array("order" => "t.order"));
     $this->render('theory', array('track' => $track, 'tasks' => $tasks));
 }
Exemplo n.º 14
0
<?php

if (Session::is_group_user('Playlist Editor')) {
    $track = Tracks::get($_REQUEST['trackid']);
    $playlist = Playlists::get($_REQUEST['playlistid']);
    $result = false;
    switch ($_REQUEST['action']) {
        case "add":
            $result = $playlist->add_track($track);
            break;
        case "del":
            $result = $playlist->del_track($track);
            break;
    }
    if ($result) {
        $new_playlists = $track->get_playlists_in();
        $playlists_arr = array();
        foreach ($new_playlists as $playlist) {
            $playlists_arr[] = $playlist->get_id();
        }
        exit(json_encode(array('result' => 'success', 'playlists' => $playlists_arr)));
    } else {
        http_response_code(400);
        exit(json_encode(array('error' => 'Unable to add track to playlist.')));
    }
} else {
    http_response_code(403);
}
Exemplo n.º 15
0
$page = isset($_REQUEST["p"]) && is_numeric($_REQUEST["p"]) ? $_REQUEST["p"] : 1;
MainTemplate::set_subtitle("Find a track in the database, edit track details");
$tracks = Tracks::get_deleted($limit, ($page - 1) * $limit);
if ($tracks) {
    $pages = new Paginator();
    $pages->items_per_page = $limit;
    $pages->index = implode(",", $index);
    $pages->mid_range = 5;
    $pages->items_total = Tracks::count_deleted();
    $pages->paginate();
    $low = ($page - 1) * $limit + 1;
    $high = $low + $limit - 1 > Tracks::count_deleted() ? Tracks::count_deleted() : $low + $limit - 1;
    echo "<script>\n\t\t\$(function () {\n\t\t\t\$('.track-info').popover({\n\t\t\t\t'html': true, \n\t\t\t\t'trigger': 'hover',\n\t\t\t\t'title': function() { \n\t\t\t\t\treturn(\$(this).parent().parent().find('.title').html())\n\t\t\t\t},\n\t\t\t\t'content': function() {\n\t\t\t\t\treturn(\$(this).parent().find('.hover-info').html());\n\t\t\t\t}\n\t\t\t});\n" . (Session::is_group_user("Playlist Admin") ? "\n\t\tvar item;\n\t\t\$('.playlist-add').click(function() {\n\t\t\titem = \$(this).parent().parent();\n\t\t\tplaylists = \$(this).attr('data-playlists-in').split(',');\n\t\t\t\$('.playlist-select').parent().removeClass('active');\n\t\t\t\$('.playlist-select').find('span').removeClass('glyphicon-minus').addClass('glyphicon-plus');\n\t\t\t\$('.playlist-select').each(function() {\n\t\t\t\tif(\$.inArray(\$(this).attr('data-playlist-id'),playlists) > -1) {\n\t\t\t\t\t\$(this).find('span').removeClass('icon-plus').addClass('glyphicon-minus');\n\t\t\t\t\t\$(this).parent().addClass('active');\n\t\t\t\t}\n\t\t\t})\n\t\t});\n\n\t\t\$('.playlist-select').click(function() {\n\t\t\tobj = \$(this);\n\t\t\tif(\$(this).parent().hasClass('active')) {\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-minus').addClass('glyphicon-refresh');\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=del',\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\n\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\n\t\t\t\t\t\tobj.parent().removeClass('active');\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-refresh');\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=add',\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\n\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\n\t\t\t\t\t\tobj.parent().addClass('active');\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\$(this).parent().addClass('active');\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-minus');\n\t\t\t}\n\t\t});\t\t\n" : "") . (Session::is_group_user("Music Admin") ? "\n\t\tvar trackid;\n\t\t\$('.track-delete').click(function() {\n\t\t\t\$('.delete-track-title').html(\$(this).parent().parent().find('.title').html());\n\t\t\ttrackid = \$(this).attr('data-dps-id');\n\t\t});\n\n\t\t\$('.yes-definitely-delete').click(function() {\n\t\t\t\$.ajax({\n\t\t\t\turl: '" . LINK_ABS . "ajax/remove-track.php',\n\t\t\t\tdata: { id: trackid },\n\t\t\t\ttype: 'POST',\n\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\talert(value.error);\n\t\t\t\t},\n\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\twindow.location.reload(true); \n\t\t\t\t}\n\t\t\t});\n\t\t});\n" : "") . "\t\t});\n\t</script>";
    echo "<a href=\"#\" id=\"flag\" data-toggle=\"modal\" data-target=\"#empty-modal\" class=\"btn btn-danger btn-block\">" . Bootstrap::glyphicon("warning-sign") . " Empty Trash</a>";
    echo "<p></p>";
    echo "<h3>" . Tracks::count_deleted() . " results for deleted items.</small></h3>";
    echo "<div class=\"row\"><div class=\"col-lg-5\"><h5>Showing results " . $low . " to " . $high . "</h5></div><div class=\"pull-right\">" . $pages->display_jump_menu() . $pages->display_items_per_page() . "</div></div>";
    echo "<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"icon\"> </th>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t<th class=\"album\">Album</th>\n\t\t\t<th class=\"length nowrap\">Length</th> \n\t\t\t" . (Session::is_group_user("Playlist Admin") ? "<th class=\"icon\"></th>" : "") . "\n\t\t\t" . (Session::is_group_user("Music Admin") ? "<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>";
    foreach ($tracks as $track) {
        echo "\n\t\t<tr id=\"" . $track->get_id() . "\">\n\t\t\t<td class=\"icon\">\n\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\n\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t\t</a>\n\t\t\t\t<div class=\"hover-info\">\n\t\t\t\t\t<strong>Artist:</strong> " . $track->get_artists_str() . "<br />\n\t\t\t\t\t<strong>Album:</strong> " . $track->get_album()->get_name() . "<br />\n\t\t\t\t\t<strong>Year:</strong> " . $track->get_year() . "<br />\n\t\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($track->get_length()) . "<br />\n\t\t\t\t\t<strong>Origin:</strong> " . $track->get_origin() . "<br />\n\t\t\t\t\t" . ($track->get_reclibid() ? "<strong>Reclib ID:</strong> " . $track->get_reclibid() . "<br />" : "") . "\n\t\t\t\t\t<strong>Censored:</strong> " . ($track->is_censored() ? "Yes" : "No") . "<br /> \n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t<td class=\"artist\">" . $track->get_artists_str() . "</td>\n\t\t\t<td class=\"title\">" . $track->get_title() . "</td>\n\t\t\t<td class=\"album\">" . $track->get_album()->get_name() . "</td>\n\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>";
        if (Session::is_group_user("Playlist Admin")) {
            $playlists = array();
            foreach ($track->get_playlists_in() as $playlist) {
                $playlists[] = $playlist->get_id();
            }
            echo "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#playlist-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" data-playlists-in=\"" . implode(",", $playlists) . "\" class=\"playlist-add\" title=\"Add to playlist\" rel=\"twipsy\">" . Bootstrap::glyphicon("plus-sign") . "</a></td>";
        }
        echo (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" class=\"track-delete\" title=\"Delete this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</a></td>" : "") . "\n\t\t</tr>";
    }
    echo "</table>";
    echo $pages->return;
Exemplo n.º 16
0
?>


			<!--  -->

			<label for="">Код для встраивания</label>

			<?php 
echo $form->textArea($video, 'embed', array('class' => 'form-control'));
?>


			<!--  -->

			<label for="">Трек, которому принадлежит видео</label>

			<?php 
echo $form->dropDownList($video, 'track', CHtml::listData(Tracks::model()->findAll(), 'id', 'title'));
?>
			
			<button type="submit" class="btn btn-success">Сохранить</button>

		</div>

	</div>

<?php 
$this->endWidget();
?>

Exemplo n.º 17
0
}
echo "<h3>Flagged for Censorship</h3>";
echo "<strong>To flag a track for censorship, search for it in the music library, click the " . Bootstrap::glyphicon("info-sign") . " and click the \"Flag for censorship\" button.</strong>";
if ($flagged = Tracks::get_flagged()) {
    echo "\n<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"icon\"></th>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t\t<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>";
    foreach ($flagged as $flag) {
        echo "\n\t<tr id=\"" . $flag->get_id() . "\">\n\t\t<td class=\"icon\">\n\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $flag->get_id() . "\" class=\"track-info\">\n\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t</a>\n\t\t\t<div class=\"hover-info\">\n\t\t\t\t<strong>Artist:</strong> " . $flag->get_artists_str() . "<br />\n\t\t\t\t<strong>Album:</strong> " . $flag->get_album()->get_name() . "<br />\n\t\t\t\t<strong>Year:</strong> " . $flag->get_year() . "<br />\n\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($flag->get_length()) . "<br />\n\t\t\t\t<strong>Origin:</strong> " . $flag->get_origin() . "<br />\n\t\t\t\t" . ($flag->get_reclibid() ? "<strong>Reclib ID:</strong> " . $flag->get_reclibid() . "<br />" : "") . "\n\t\t\t</div>\n\t\t</td>\n\t\t<td class=\"artist\">" . $flag->get_artists_str() . "</td>\n\t\t<td class=\"title\">" . $flag->get_title() . "</td>\n\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?censor=" . $flag->get_id() . "\" class=\"censor\" title=\"Approve censorship\" rel=\"twipsy\">" . Bootstrap::glyphicon("ok-sign") . "</td>\n\t\t<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?unflag=" . $flag->get_id() . "\" class=\"unflag\" title=\"Remove flag\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</td>" : "") . "\n\t</tr>";
    }
    echo "\n</table>";
} else {
    echo "<h4>No tracks currently flagged for censorship.</h4>";
}
$limit = isset($_REQUEST['n']) ? $_REQUEST['n'] : 10;
$page = isset($_REQUEST['p']) ? $_REQUEST['p'] : 1;
$num_of_censored = Tracks::count_censored();
if ($censored = Tracks::get_censored($limit, ($page - 1) * $limit)) {
    $pages = new Paginator();
    $pages->items_per_page = $limit;
    $pages->querystring = NULL;
    $pages->mid_range = 5;
    $pages->items_total = $num_of_censored;
    $pages->paginate();
    $low = ($page - 1) * $limit + 1;
    $high = $low + $limit - 1 > $num_of_censored ? $num_of_censored : $low + $limit - 1;
    echo "\n<h3>Censored Tracks</h3>\n<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"icon\"></th>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t\t<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>";
    foreach ($censored as $censor) {
        echo "\n\t<tr id=\"" . $censor->get_id() . "\">\n\t\t<td class=\"icon\">\n\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $censor->get_id() . "\" class=\"track-info\">\n\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t</a>\n\t\t\t<div class=\"hover-info\">\n\t\t\t\t<strong>Artist:</strong> " . $censor->get_artists_str() . "<br />\n\t\t\t\t<strong>Album:</strong> " . $censor->get_album()->get_name() . "<br />\n\t\t\t\t<strong>Year:</strong> " . $censor->get_year() . "<br />\n\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($censor->get_length()) . "<br />\n\t\t\t\t<strong>Origin:</strong> " . $censor->get_origin() . "<br />\n\t\t\t\t" . ($censor->get_reclibid() ? "<strong>Reclib ID:</strong> " . $censor->get_reclibid() . "<br />" : "") . "\n\t\t\t</div>\n\t\t</td>\n\t\t<td class=\"artist\">" . $censor->get_artists_str() . "</td>\n\t\t<td class=\"title\">" . $censor->get_title() . "</td>\n\t\t" . (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?uncensor=" . $censor->get_id() . "\" class=\"uncensor\" title=\"Uncensor this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</td>" : "") . "\n\t</tr>";
    }
    echo "\n</table>";
    echo $pages->return;
} else {
Exemplo n.º 18
0
 /**
  *
  *  Показывает для редактирования и сохраняет трек
  * 
  *  @param id 
  *  @return true
  *
  **/
 public function actionEdit_track($id)
 {
     if (!Yii::app()->my->access("edit")) {
         return false;
     }
     $track = Tracks::model()->findByPk($id);
     if (isset($_REQUEST['Tracks'])) {
         foreach ($_REQUEST['Tracks'] as $key => $value) {
             $track->{$key} = $value;
         }
         if ($track->save()) {
             Yii::app()->notify->add("Трек сохранен. <a href='/track/" . $track->code . "' target='blank'><u>Перейти к треку</u></a>");
             if (isset($_REQUEST['Tracks']["Docs"])) {
                 $track->setRelationRecords("Docs", $_REQUEST['Tracks']["Docs"]);
             }
             if (isset($_REQUEST['Tracks']["Algorithms"])) {
                 $track->setRelationRecords("Algorithms", $_REQUEST['Tracks']["Algorithms"]);
             }
         } else {
             Yii::app()->notify->add("Не удалось сохранить", "danger");
             //print_r($task->getErrors());
         }
     }
     $this->render("track", array("track" => $track));
 }
Exemplo n.º 19
0
<?php

Output::set_template();
$query = $_REQUEST['q'];
if ($query) {
    $search = Search::prerecords(str_replace(" ", " | ", $query), 5);
}
$tracks = $search["results"];
$tracks_array = array();
if ($tracks) {
    foreach ($tracks as $track_id) {
        $track_object = Tracks::get($track_id);
        $track = array('id' => $track_object->get_id(), 'title' => $track_object->get_title(), 'by' => $track_object->get_artists_str(), 'href' => LINK_ABS . "music/detail/" . $track_object->get_id());
        array_push($tracks_array, $track);
    }
}
$array = array("title" => "Prerecords", "href" => LINK_ABS . "music/search/?i=title&q=" . $query, "data" => $tracks_array);
echo json_encode($array);
Exemplo n.º 20
0
			<label for="">Порядок</label>

			<?php 
echo $form->textField($faq, 'order', array('class' => 'form-control'));
?>
			
		</div><!-- /.col-md-4 -->
 

		<div class="col-md-4">
			
			<label for="">Трек, которому принадлежит видео</label>

			<?php 
echo $form->dropDownList($faq, 'track', CHtml::listData(Tracks::model()->findAll(), 'id', 'title'), array('class' => 'form-control'));
?>
			
		</div><!-- /.col-md-4 -->

		

		<div class="col-md-4">

			<label for="">&nbsp;</label>	

			<button type="submit" class="btn btn-success form-control">Сохранить</button>
			
		</div><!-- /.col-md-4 -->

 
Exemplo n.º 21
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Tracks::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 22
0
 * @version 1.0.0
 *
 * @api
 */
require_once $_SERVER['DOCUMENT_ROOT'] . '/server/lib/Configuration.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/server/lib/Api.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/server/lib/Track.php';
$api = new Api('json', ['GET']);
switch ($api->method) {
    case 'GET':
        //returns the folders
        if (!$api->checkAuth()) {
            //User not authentified/authorized
            return false;
        }
        if (!$api->checkScope('admin')) {
            $api->output(403, 'Admin scope is required for listing folders');
            //current user has no admin scope, return forbidden
            return;
        }
        $library = new Tracks();
        $configuration = new Configuration();
        $library->getFolders($configuration->get('filesPath'));
        if (count($library->folders) == 0) {
            $api->output(204);
            //end the process
            return;
        }
        $api->output(200, $library->folders);
        break;
}
Exemplo n.º 23
0
    echo "\r\n\t\t<table class=\"table table-striped table-condensed\" cellspacing=\"0\">\r\n\t\t\t<thead>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class=\"icon\"></th>\r\n\t\t\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t\t\t<th class=\"title\">Title</th>" . (Session::is_group_user("Requests Admin") ? "\r\n\t\t\t\t\t<th class=\"icon\"></th>" : "") . "\r\n\t\t\t\t</tr>\r\n\t\t\t</thead>";
    foreach ($requested as $request) {
        echo "\r\n\t\t\t<tr id=\"" . $request->get_id() . "\">\r\n\t\t\t\t<td class=\"icon\">\r\n\t\t\t\t\t<a href=\"#\" class=\"track-info\">\r\n\t\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\r\n\t\t\t\t\t</a>\r\n\t\t\t\t\t<div class=\"hover-info\">\r\n\t\t\t\t\t\t<strong>Artist:</strong> " . $request->get_artist_name() . "<br />\r\n\t\t\t\t\t\t<strong>Title:</strong> " . $request->get_name() . "<br />\r\n\t\t\t\t\t\t<strong>Date Requested:</strong> " . date("d/m/Y H:i", $request->get_date()) . "<br />\r\n\t\t\t\t\t\t<strong>Requester:</strong> " . $request->get_user()->get_username() . "<br />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class=\"artist\">" . $request->get_artist_name() . "</td>\r\n\t\t\t\t<td class=\"title\">" . $request->get_name() . "</td>\r\n\t\t\t\t" . (Session::is_group_user("Requests Admin") ? "<td class=\"icon\"><a href=\"" . LINK_ABS . "music/request/delete?id=" . $request->get_id() . "\" class=\"request-delete\" title=\"Delete this request\" rel=\"twipsy\">" . Bootstrap::glyphicon("minus-sign") . "</td>" : "") . "\r\n\t\t\t</tr>";
    }
    echo "\r\n\t\t</table>";
    $total_requests = Requests::count();
    if ($total_requests <= count($requested)) {
        echo "<a href=\"" . LINK_ABS . "music/request\">&raquo; Go to requests</a>";
    } else {
        echo "<a href=\"" . LINK_ABS . "music/request\">&raquo; See " . ($total_requests - count($requested)) . " more requests</a>";
    }
} else {
    echo "\r\n\t\t<strong>No new requested tracks.</strong><br />\r\n\t\t<a href=\"" . LINK_ABS . "music/request\">&raquo; Go to requests</a>";
}
echo "\r\n\t</div>\r\n</div>\r\n<hr />\r\n";
$tracks = Tracks::get_newest();
if ($tracks) {
    echo "<h3>10 newest tracks</h3>";
    echo "<div class=\"table-responsive\"><table class=\"table table-striped\" cellspacing=\"0\">\r\n\t<thead>\r\n\t\t<tr>\r\n\t\t\t<th class=\"icon\"> </th>\r\n\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t<th class=\"title\">Title</th>\r\n\t\t\t<th class=\"date-added nowrap\">Date Added</th>\r\n\t\t\t<th class=\"length nowrap\">Length</th> \r\n\t\t\t" . (Session::is_group_user("Playlist Editor") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t\t" . (Session::is_group_user("Librarian") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t</tr>\r\n\t</thead>";
    foreach ($tracks as $track) {
        $import_date = date("d/m/Y H:i", $track->get_import_date());
        echo "\r\n\t\t<tr id=\"" . $track->get_id() . "\">\r\n\t\t\t<td class=\"icon\">\r\n\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\r\n\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\r\n\t\t\t\t</a>\r\n\t\t\t\t<div class=\"hover-info\">\r\n\t\t\t\t\t<strong>Artist:</strong> " . $track->get_artists_str() . "<br />\r\n\t\t\t\t\t<strong>Album:</strong> " . $track->get_album()->get_name() . "<br />\r\n\t\t\t\t\t<strong>Year:</strong> " . $track->get_year() . "<br />\r\n\t\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($track->get_length()) . "<br />\r\n\t\t\t\t\t<strong>Origin:</strong> " . $track->get_origin() . "<br />\r\n\t\t\t\t\t" . ($track->get_reclibid() ? "<strong>Reclib ID:</strong> " . $track->get_reclibid() . "<br />" : "") . "\r\n\t\t\t\t\t<strong>Censored:</strong> " . ($track->is_censored() ? "Yes" : "No") . "<br /> \r\n\t\t\t\t</div>\r\n\t\t\t</td>\r\n\t\t\t<td class=\"artist\">" . $track->get_artists_str() . "</td>\r\n\t\t\t<td class=\"title\">" . $track->get_title() . "</td>\r\n\t\t\t<td class=\"date-added nowrap\">" . $import_date . "</td>\r\n\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>\r\n\t\t\t";
        if (Session::is_group_user("Playlist Editor")) {
            $playlists = array();
            foreach ($track->get_playlists_in() as $playlist) {
                $playlists[] = $playlist->get_id();
            }
            echo "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#playlist-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" data-playlists-in=\"" . implode(",", $playlists) . "\" class=\"playlist-add\" title=\"Add to playlist\" rel=\"twipsy\">" . Bootstrap::glyphicon("plus-sign") . "</i></a></td>";
        }
        echo (Session::is_group_user("Librarian") ? "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-dps-id=\"" . $track->get_id() . "\" class=\"track-delete\" title=\"Delete this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</i></a></td>" : "") . "\r\n\t\t</tr>";
    }
Exemplo n.º 24
0
    $pages = new Paginator();
    $pages->items_per_page = $limit;
    $pages->querystring = $query;
    $pages->index = implode(",", $index);
    $pages->mid_range = 5;
    $pages->items_total = $search["total"];
    $pages->paginate();
    $low = ($page - 1) * $limit + 1;
    $high = $low + $limit - 1 > $search["total"] ? $search["total"] : $low + $limit - 1;
    echo "<script>\r\n\t\t\$(function () {\r\n\t\t\t\$('.track-info').popover({\r\n\t\t\t\t'html': true, \r\n\t\t\t\t'trigger': 'hover',\r\n\t\t\t\t'title': function() { \r\n\t\t\t\t\treturn(\$(this).parent().parent().find('.title').html())\r\n\t\t\t\t},\r\n\t\t\t\t'content': function() {\r\n\t\t\t\t\treturn(\$(this).parent().find('.hover-info').html());\r\n\t\t\t\t}\r\n\t\t\t});\r\n" . (Session::is_group_user("Playlist Admin") ? "\r\n\t\tvar item;\r\n\t\t\$('.playlist-add').click(function() {\r\n\t\t\titem = \$(this).parent().parent();\r\n\t\t\tplaylists = \$(this).attr('data-playlists-in').split(',');\r\n\t\t\t\$('.playlist-select').parent().removeClass('active');\r\n\t\t\t\$('.playlist-select').find('span').removeClass('glyphicon-minus').addClass('glyphicon-plus');\r\n\t\t\t\$('.playlist-select').each(function() {\r\n\t\t\t\tif(\$.inArray(\$(this).attr('data-playlist-id'),playlists) > -1) {\r\n\t\t\t\t\t\$(this).find('span').removeClass('icon-plus').addClass('glyphicon-minus');\r\n\t\t\t\t\t\$(this).parent().addClass('active');\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t});\r\n\r\n\t\t\$('.playlist-select').click(function() {\r\n\t\t\tobj = \$(this);\r\n\t\t\tif(\$(this).parent().hasClass('active')) {\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-minus').addClass('glyphicon-refresh');\r\n\t\t\t\t\$.ajax({\r\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\r\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=del',\r\n\t\t\t\t\ttype: 'POST',\r\n\t\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\r\n\t\t\t\t\t\talert(value.error);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\r\n\t\t\t\t\t\tobj.parent().removeClass('active');\r\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-refresh');\r\n\t\t\t\t\$.ajax({\r\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\r\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=add',\r\n\t\t\t\t\ttype: 'POST',\r\n\t\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\r\n\t\t\t\t\t\talert(value.error);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\r\n\t\t\t\t\t\tobj.parent().addClass('active');\r\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\t\$(this).parent().addClass('active');\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-minus');\r\n\t\t\t}\r\n\t\t});\t\t\r\n" : "") . (Session::is_group_user("Music Admin") ? "\r\n\t\tvar trackid;\r\n\t\t\$('.track-delete').click(function() {\r\n\t\t\t\$('.delete-track-title').html(\$(this).parent().parent().find('.title').html());\r\n\t\t\ttrackid = \$(this).attr('data-dps-id');\r\n\t\t});\r\n\r\n\t\t\$('.yes-definitely-delete').click(function() {\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/delete-track.php',\r\n\t\t\t\tdata: 'id='+trackid,\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\talert(value.error);\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\twindow.location.reload(true); \r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n" : "") . "\t\t});\r\n\t</script>";
    $indexes = implode(", ", $index);
    echo "<h3>" . $search["total"] . " results for " . $query . "<small> searching in " . $indexes . "</small></h3>";
    echo "<div class=\"row\"><div class=\"col-lg-5\"><h5>Showing results " . $low . " to " . $high . "</h5></div><div class=\"pull-right\">" . $pages->display_jump_menu() . $pages->display_items_per_page() . "</div></div>";
    echo "<table class=\"table table-striped\" cellspacing=\"0\">\r\n\t<thead>\r\n\t\t<tr>\r\n\t\t\t<th class=\"icon\"> </th>\r\n\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t<th class=\"title\">Title</th>\r\n\t\t\t<th class=\"album\">Album</th>\r\n\t\t\t<th class=\"length nowrap\">Length</th> \r\n\t\t\t" . (Session::is_group_user("Playlist Admin") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t\t" . (Session::is_group_user("Music Admin") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t</tr>\r\n\t</thead>";
    foreach ($tracks as $track_id) {
        $track = Tracks::get($track_id);
        echo "\r\n\t\t<tr id=\"" . $track->get_id() . "\">\r\n\t\t\t<td class=\"icon\">\r\n\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\r\n\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\r\n\t\t\t\t</a>\r\n\t\t\t\t<div class=\"hover-info\">\r\n\t\t\t\t\t<strong>Artist:</strong> " . $track->get_artists_str() . "<br />\r\n\t\t\t\t\t<strong>Album:</strong> " . $track->get_album()->get_name() . "<br />\r\n\t\t\t\t\t<strong>Year:</strong> " . $track->get_year() . "<br />\r\n\t\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($track->get_length()) . "<br />\r\n\t\t\t\t\t<strong>Origin:</strong> " . $track->get_origin() . "<br />\r\n\t\t\t\t\t" . ($track->get_reclibid() ? "<strong>Reclib ID:</strong> " . $track->get_reclibid() . "<br />" : "") . "\r\n\t\t\t\t\t<strong>Censored:</strong> " . ($track->is_censored() ? "Yes" : "No") . "<br /> \r\n\t\t\t\t</div>\r\n\t\t\t</td>\r\n\t\t\t<td class=\"artist\">" . $track->get_artists_str() . "</td>\r\n\t\t\t<td class=\"title\">" . $track->get_title() . "</td>\r\n\t\t\t<td class=\"album\">" . $track->get_album()->get_name() . "</td>\r\n\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>";
        if (Session::is_group_user("Playlist Admin")) {
            $playlists = array();
            foreach ($track->get_playlists_in() as $playlist) {
                $playlists[] = $playlist->get_id();
            }
            echo "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#playlist-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" data-playlists-in=\"" . implode(",", $playlists) . "\" class=\"playlist-add\" title=\"Add to playlist\" rel=\"twipsy\">" . Bootstrap::glyphicon("plus-sign") . "</a></td>";
        }
        echo (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" class=\"track-delete\" title=\"Delete this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</a></td>" : "") . "\r\n\t\t</tr>";
    }
    echo "</table>";
    echo $pages->return;
} else {
    if ($query) {
        echo "<h3>Sorry, no results for " . $query . "</h3>";
Exemplo n.º 25
0
?>
			<br>
			<!-- Название -->
			<label for="">Описание</label>
			<?php 
echo $form->textArea($task, 'description', array('class' => 'form-control'));
?>

			
		</div>
		<div class="col-md-3">

			<!-- Трек -->
			<label for="">Тема</label>
			<?php 
$list = CHtml::listData(Tracks::model()->findAll(), 'id', 'title');
?>

			<?php 
echo $form->dropDownList($task, 'track', $list, array('class' => 'form-control'));
?>

			<br>

			<!-- Курс --> 
			<label for="">Курс</label>
			<?php 
$list = CHtml::listData(Courses::model()->findAll(), 'id', 'title');
?>
			<?php 
echo $form->dropDownList($task, 'course', $list, array('class' => 'form-control'));
Exemplo n.º 26
0
 public static function get_by_md5($md5)
 {
     $type = DigiplayDB::select("type FROM audio WHERE md5 = '" . $md5 . "'");
     if ($type) {
         if ($type == 1) {
             return Tracks::get_by_md5($md5);
         } else {
             if ($type == 2) {
                 return Jingles::get_by_md5($md5);
             } else {
                 if ($type == 3) {
                     return Adverts::get_by_md5($md5);
                 } else {
                     if ($type == 4) {
                         return Prerecs::get_by_md5($md5);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 27
0
 public function actionIndex()
 {
     $tracks = Tracks::model()->with("Videos")->findAll();
     $this->render('index', array("tracks" => $tracks));
 }
Exemplo n.º 28
0
<?php

if (Session::is_group_user("Music Admin")) {
    $tracks = Tracks::get_deleted();
    foreach ($tracks as $track) {
        $id = $track->get_id();
        $md5 = $track->get_md5();
        $archive = $track->get_archive();
        $dir = $archive->get_localpath();
        $folder = $md5[0];
        $files = array(0 => '.flac', 1 => '.xml');
        $tables = array(0 => 'audioartists', 1 => 'audiocomments', 2 => 'audiodir', 3 => 'audiogroups', 4 => 'audiojinglepkgs', 5 => 'audiokeywords', 6 => 'audioplaylists', 7 => 'audiousers');
        $wherepre = "audioid = " . $id;
        $where = pg_escape_string($wherepre);
        $track_id_escaped = pg_escape_string($id);
        DigiplayDB::delete('audio', "id = " . $track_id_escaped);
        foreach ($tables as $table) {
            DigiplayDB::delete($table, $where);
        }
        foreach ($files as $file) {
            $path = $dir . "/" . $folder . "/" . $md5 . $file;
            $cmd = "rm " . $path;
            shell_exec($cmd);
        }
    }
    if (Errors::occured()) {
        http_response_code(400);
        exit(json_encode(array("error" => "Something went wrong. You may have discovered a bug!", "detail" => Errors::report("array"))));
        Errors::clear();
    } else {
        exit(json_encode(array('response' => 'success', 'id' => 1)));
Exemplo n.º 29
0
<?php

Output::set_title("Track Detail");
MainTemplate::set_subtitle("View and edit track metadata");
Output::add_stylesheet(LINK_ABS . "css/bootstrap-select.css");
Output::add_script(LINK_ABS . "js/bootstrap-select.js");
if (!isset($_GET['id'])) {
    exit("<h3>No track specified</h3><h4>You must access this via another page, to get metadata for a specified track.</h4>");
}
if (!($track = Tracks::get($_GET["id"]))) {
    exit("<h3>Invalid track ID</h3><h4>If you got to this page via a link from somewhere else on the site, there may be a bug.  A bug you should bug the techies about!</h4>");
}
if (!Session::is_group_user("Music Admin")) {
    $disabled = " disabled";
} else {
    $disabled = "";
}
echo "\n\t<script>\n\t\t\$(function () {\n\t\t\t\$('.track-detail-form').submit(function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsubmit = \$(this).find('button[type=\"submit\"]');\n\t\t\t\tsubmit.find('span').removeClass('glyphicon-save').addClass('glyphicon-refresh');\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-detail-update.php',\n\t\t\t\t\tdata: \$(this).serialize(),\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\tsubmit.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-save');\n\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("danger", "'+value.error+'", "Error!") . "');\n\t\t\t\t\t\tconsole.error(value.detail);\n\t\t\t\t\t\t\$('.alert-message').alert();\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\tsubmit.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-save');\n\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("success", "Track details altered.", "Success!", false) . "');\n\t\t\t\t\t\t\$('[id=new_artist]').val('');\n\t\t\t\t\t\t\$('[id=artist\\\\[\\\\]]').parent('.col-md-10').remove();\n\t\t\t\t\t\tartists_str = '';\n\t\t\t\t\t\tfirst = true;\n\t\t\t\t\t\t\$.each(values.artists, function(i, val) {\n\t\t\t\t\t\t\tartists_str += '<div class=\"col-md-10'+(first? '' : ' col-md-offset-2')+'\"><input type=\"text\" id=\"artist[]\" name=\"artist[]\" class=\"form-control" . $disabled . "\" value=\"'+val+'\"></div>';\n\t\t\t\t\t\t\tfirst = false;\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('[for=artist]').after(artists_str);\n\t\t\t\t\t\t\$('[id=new_keyword]').val('');\n\t\t\t\t\t\t\$('.keyword').parent().remove();\n\t\t\t\t\t\tkeywords_str = '';\n\t\t\t\t\t\t\$.each(values.keywords, function(i, val) {\n\t\t\t\t\t\t\tkeywords_str += '<div class=\"input-group\"><span class=\"input-group-addon\"><a class=\"keyword-remove\" href=\"" . LINK_ABS . "ajax/del-keywords.php?track_id=" . $track->get_id() . "&keyword='+val+'\">" . Bootstrap::glyphicon("remove-sign") . "</a></span><input type=\"text\" class=\"form-control\" disabled value=\"'+val+'\"></div></div>'\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('.for-keywords').html(keywords_str);\n\t\t\t\t\t\tsetTimeout(function() {\n    \t\t\t\t\t\t\$('.alert').hide('fast', function(){\n        \t\t\t\t\t\t\$(this).remove(); \n           \t\t\t\t});},4000);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t\$('.keyword-remove').on(\"click\", function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tparent = \$(this).parent().parent();\n\t\t\t\t\$.get(\$(this).attr('href'), function(data) {\n\t\t\t\t\tif(data == \"success\") {\n\t\t\t\t\t\tparent.remove();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("danger", "'+data+'", "Error!") . "');\n\t\t\t\t\t\t\$('.alert-message').show('fast').alert();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t\$('[id=flag]').click(function() {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tt = \$(this);\n\t\t\t\tt.find('.censor-flag').removeClass('glyphicon-warning-sign').addClass('glyphicon-refresh');\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/flag.php',\n\t\t\t\t\tdata: 'id=" . $track->get_id() . "&flag=toggle',\n\t\t\t\t\ttype: 'GET',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("danger", "'+value.error+'", "Error!") . "');\n\t\t\t\t\t\t\$('.alert-message').alert();\n\t\t\t\t\t\tt.find('.censor-flag').removeClass('glyphicon-refresh').addClass('glyphicon-warning-sign');\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\t\tt.find('.censor-flag').removeClass('glyphicon-refresh').addClass('glyphicon-warning-sign');\n\t\t\t\t\t\t\tif(value.response == 'flagged') {\n\t\t\t\t\t\t\t\tt.addClass('active');\n\t\t\t\t\t\t\t\tresponse = 'This track has been flagged for censorship and will be reviewed in due course.';\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tt.removeClass('active');\n\t\t\t\t\t\t\t\tresponse = 'This track has been unflagged.';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("warning", "'+response+'", "Success!", false) . "'); \n\t\t\t\t\t\t\tsetTimeout(function() {\n\t    \t\t\t\t\t\t\$('.alert').hide('fast', function(){\n\t        \t\t\t\t\t\t\$(this).remove(); \n\t           \t\t\t\t});},4000);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n" . (Session::is_group_user("Playlist Editor") ? "\n\t\t\tvar item;\n\t\t\t\$('.playlist-add').click(function() {\n\t\t\t\titem = \$(this);\n\t\t\t\tplaylists = \$(this).attr('data-playlists-in').split(',');\n\t\t\t\t\$('.playlist-select').parent().removeClass('active');\n\t\t\t\t\$('.playlist-select').find('span').removeClass('glyphicon-minus').addClass('glyphicon-plus');\n\t\t\t\t\$('.playlist-select').each(function() {\n\t\t\t\t\tif(\$.inArray(\$(this).attr('data-playlist-id'),playlists) > -1) {\n\t\t\t\t\t\t\$(this).find('span').removeClass('icon-plus').addClass('glyphicon-minus');\n\t\t\t\t\t\t\$(this).parent().addClass('active');\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t});\n\n\t\t\t\$('.playlist-select').click(function() {\n\t\t\t\tobj = \$(this);\n\t\t\t\tif(\$(this).parent().hasClass('active')) {\n\t\t\t\t\t\$(this).find('span').removeClass('glyphicon-minus').addClass('glyphicon-refresh');\n\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\n\t\t\t\t\t\tdata: 'trackid='+item.attr('data-dps-id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=del',\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\n\t\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\n\t\t\t\t\t\t\tobj.parent().removeClass('active');\n\t\t\t\t\t\t\titem.attr('data-playlists-in',values.playlists.join(','));\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-refresh');\n\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\n\t\t\t\t\t\tdata: 'trackid='+item.attr('data-dps-id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=add',\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\n\t\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\n\t\t\t\t\t\t\tobj.parent().addClass('active');\n\t\t\t\t\t\t\titem.attr('data-playlists-in',values.playlists.join(','));\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\t\$(this).parent().addClass('active');\n\t\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-minus');\n\t\t\t\t}\n\t\t\t});\t\t\n" : "") . "\n\t\t});\n\t</script>\n\t<h3>Edit Track: " . $track->get_id() . " <small>Added " . date("d/m/Y H:i", $track->get_import_date()) . "</small></h3>\n\t" . (Session::is_group_user("Music Admin") ? "" : Bootstrap::alert_message_basic("info", "You can't edit the details of this track, because you aren't a Music Admin.", "Notice:"));
echo $track->player() . "\n\t<form class=\"track-detail-form\" action=\"\" method=\"post\">\n\t\t<fieldset>\n\t\t\t<div class=\"row\">\n\t\t\t\t<div class=\"col-md-7 form-horizontal\">\n\t\t\t\t\t<input type=\"hidden\" id=\"id\" name=\"id\" value=\"" . $track->get_id() . "\">\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"title\">Title</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"title\" name=\"title\" class=\"form-control\" " . $disabled . " value=\"" . $track->get_title() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"artist\">Artists</label>";
$first = true;
foreach ($track->get_artists() as $key => $artist) {
    echo "\n\t\t\t\t\t\t<div class=\"col-md-10" . (!$first ? " col-md-offset-2" : "") . "\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"artist[]\"  name=\"artist[]\" class=\"form-control\" " . $disabled . " value=\"" . $artist->get_name() . "\">\n\t\t\t\t\t\t</div>";
    $first = false;
}
echo "\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"new_artist\" name=\"new-artist\" class=\"form-control\" " . $disabled . " placeholder=\"Add new artist...\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"album\">Album</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"album\" name=\"album\" class=\"form-control\" " . $disabled . " value=\"" . $track->get_album()->get_name() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"year\">Year</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" id=\"year\" name=\"year\" " . $disabled . " value=\"" . $track->get_year() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"length\">Length</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<p class=\"form-control-static\">" . Time::format_succinct($track->get_length()) . "</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"origin\">Origin</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"origin\" name=\"origin\" class=\"form-control\" " . $disabled . " value=\"" . $track->get_origin() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<div class=\"checkbox\">\n\t\t\t\t\t\t\t\t<label for=\"censored\">\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" id=\"censored\" name=\"censored\" " . $disabled . " " . ($track->is_censored() ? "checked" : "") . ">\n\t\t\t\t\t\t\t\t\tExplicit\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-primary btn-block\">\n\t\t\t\t\t\t\t\t" . Bootstrap::glyphicon("save save") . "\n\t\t\t\t\t\t\t\tSave\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-md-5 form\">\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"notes\">Notes</label>\n\t\t\t\t\t\t<textarea class=\"form-control\" id=\"notes\" name=\"notes\" " . $disabled . ">" . $track->get_notes() . "</textarea>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"keyword\">Keywords</label>\n\t\t\t\t\t\t<div class=\"for-keywords\">";
foreach ($track->get_keywords() as $keyword) {
    echo "\n\t\t\t\t\t\t\t\t<div class=\"input-group\">\n\t\t\t\t\t\t\t\t\t<span class=\"input-group-addon\"><a class=\"keyword-remove\" href=\"" . LINK_ABS . "ajax/del-keywords.php?track_id=" . $track->get_id() . "&keyword=" . $keyword->get_text() . "\">" . Bootstrap::glyphicon("remove-sign") . "</a></span>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" disabled value=\"" . $keyword->get_text() . "\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t";
}
echo "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"input-group\">\n\t\t\t\t\t\t\t<span class=\"input-group-addon\">" . Bootstrap::glyphicon("tag") . "</span>\n\t\t\t\t\t\t\t<input type=\"text\" id=\"new_keyword\" name=\"new_keyword\" class=\"form-control\" " . $disabled . " placeholder=\"Add new keyword...\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"type\">Audio Type</label>\n\t\t\t\t\t\t<select class=\"selectpicker\" id=\"type\" name=\"type\" data-width=\"100%\" " . $disabled . ">";
foreach (AudioTypes::get_all() as $audiotype) {
    if ($audiotype->get_id() == $track->get_type()->get_id()) {