everything is implemented backend wise for schedule dialog, just need to add html/css changes
This commit is contained in:
parent
be4d3f5466
commit
f18f500e1e
7 changed files with 124 additions and 134 deletions
|
@ -151,71 +151,6 @@ class Playlist {
|
|||
return $res;
|
||||
}
|
||||
|
||||
public static function findPlaylistMaxLength($p_length)
|
||||
{
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
$sql = "SELECT sub.login, plt.length, pl.state, pl.creator, pl.description, pl.name, pl.id
|
||||
FROM cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id
|
||||
WHERE plt.length <= '{$p_length}' ";
|
||||
|
||||
$r = $con->query($sql);
|
||||
return $r->fetchAll();
|
||||
}
|
||||
|
||||
public static function searchPlaylists($p_length, $search=null)
|
||||
{
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
$sql = "SELECT sub.login, plt.length, pl.state, pl.creator, pl.description, pl.name, pl.id
|
||||
FROM cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id
|
||||
WHERE plt.length <= '{$p_length}' ";
|
||||
|
||||
|
||||
if(!is_null($search)) {
|
||||
$keywords = explode(" ", $search);
|
||||
|
||||
$categories = array("pl.description", "pl.name", "pl.creator", "sub.login");
|
||||
|
||||
for($group_id=1; $group_id <= count($keywords); $group_id++) {
|
||||
|
||||
for($row_id=1; $row_id <= count($categories); $row_id++) {
|
||||
|
||||
$md["group_".$group_id]["row_".$row_id]["metadata"] = $categories[$row_id-1];
|
||||
$md["group_".$group_id]["row_".$row_id]["match"] = "ILIKE";
|
||||
$md["group_".$group_id]["row_".$row_id]["search"] = $keywords[$group_id-1];
|
||||
}
|
||||
}
|
||||
|
||||
$and_cond = array();
|
||||
foreach (array_keys($md) as $group) {
|
||||
|
||||
$or_cond = array();
|
||||
foreach (array_keys($md[$group]) as $row) {
|
||||
|
||||
$string = $md[$group][$row]["metadata"];
|
||||
$string = $string ." ".$md[$group][$row]["match"];
|
||||
$string = $string." '%". $md[$group][$row]["search"]."%'";
|
||||
|
||||
$or_cond[] = $string;
|
||||
}
|
||||
|
||||
if(count($or_cond) > 0) {
|
||||
$and_cond[] = "(".join(" OR ", $or_cond).")";
|
||||
}
|
||||
}
|
||||
|
||||
$where_search = " AND ". join(" AND ", $and_cond);
|
||||
$sql = $sql . $where_search;
|
||||
}
|
||||
|
||||
//echo $sql;
|
||||
|
||||
$r = $con->query($sql);
|
||||
return $r->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch instance of Playlist object.<br>
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue