Assembla home | Assembla project page
 

Changeset 1098

Show
Ignore:
Timestamp:
10/06/08 11:05:03 (2 months ago)
Author:
Pernod
Message:

Added ability to filter videos that have no details available on the Edit Video and TV pages.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/swisscenter/base/db_abstract.php

    r871 r1098  
    111111 
    112112    foreach ($movies as $movie_id) 
    113       db_sqlcommand("update movies set ".db_array_to_set_list($columns)." where file_id=".$movie_id,false); 
     113    { 
     114      if (count($columns)>0) 
     115        db_sqlcommand("update movies set ".db_array_to_set_list($columns)." where file_id=".$movie_id,false); 
     116      // Determine whether any details other than title are available 
     117      db_sqlcommand("update movies set details_available='".(scdb_movie_details_available($movie_id) ? 'Y' : 'N')."' where file_id=".$movie_id,false); 
     118    } 
    114119  }    
    115120  
     
    219224 
    220225    foreach ($tv as $tv_id) 
    221       db_sqlcommand("update tv set ".db_array_to_set_list($columns)." where file_id=".$tv_id,false); 
     226    { 
     227      if (count($columns)>0) 
     228        db_sqlcommand("update tv set ".db_array_to_set_list($columns)." where file_id=".$tv_id,false); 
     229      // Determine whether any details other than title are available 
     230      db_sqlcommand("update tv set details_available='".(scdb_tv_details_available($tv_id) ? 'Y' : 'N')."' where file_id=".$tv_id,false); 
     231    } 
    222232  }    
    223233   
     
    253263  } 
    254264   
     265  // ---------------------------------------------------------------------------------------- 
     266  // Determine whether any details other than title are available 
     267  // ---------------------------------------------------------------------------------------- 
     268 
     269  function scdb_movie_details_available( $movie_id ) 
     270  { 
     271    $attribs   = implode('',db_row("select year, certificate, synopsis from movies where file_id=$movie_id")); 
     272    $actors    = db_value("select count(actor_id) from actors_in_movie where movie_id=$movie_id"); 
     273    $directors = db_value("select count(director_id) from directors_of_movie where movie_id=$movie_id"); 
     274    $genres    = db_value("select count(genre_id) from genres_of_movie where movie_id=$movie_id"); 
     275    if (empty($attribs) && $actors==0 && $directors==0 && $genres==0) 
     276      return false; 
     277    else 
     278      return true; 
     279  } 
     280   
     281  function scdb_tv_details_available( $tv_id ) 
     282  { 
     283    $attribs   = implode(db_row('',"select year, certificate, synopsis from tv where file_id=$tv_id")); 
     284    $actors    = db_value("select count(actor_id) from actors_in_tv where tv_id=$tv_id"); 
     285    $directors = db_value("select count(director_id) from directors_of_tv where tv_id=$tv_id"); 
     286    $genres    = db_value("select count(genre_id) from genres_of_tv where tv_id=$tv_id"); 
     287    if (empty($attribs) && $actors==0 && $directors==0 && $genres==0) 
     288      return false; 
     289    else 
     290      return true; 
     291  } 
     292   
    255293/************************************************************************************************** 
    256294                                               End of file 
  • trunk/swisscenter/config/config_movie.php

    r1095 r1098  
    175175 
    176176    echo '<table class="form_select_tab" width="100%"><tr> 
    177           <td valign="top" width="4%"><input type="checkbox" name="movie[]" value="'.$movie["FILE_ID"].'"></input></td> 
     177          <td valign="top" width="4%"'.($movie["DETAILS_AVAILABLE"]=='Y' ? '' : ' bgcolor="red"').'><input type="checkbox" name="movie[]" value="'.$movie["FILE_ID"].'"></input></td> 
    178178          <td valign="top" width="33%"> 
    179              <a href="?section=movie&action=display_info&movie_id='.$movie["FILE_ID"].'">'.$movie["TITLE"].'</a><br> 
     179             <a href="?section=movie&action=display_info&movie_id='.$movie["FILE_ID"].'">'.highlight($movie["TITLE"], $_REQUEST["search"]).'</a><br> 
    180180             Certificate : '.nvl($cert).'<br> 
    181181             Year : '.nvl($movie["YEAR"]).'<br> 
     
    210210    $img_url     = img_gen(file_albumart($filename) ,130,400,false,false,false,array('hspace'=>0,'vspace'=>4) ); 
    211211    $edit_url    = '?section=movie&action=display_info&movie_id='.$movie["FILE_ID"]; 
    212     $thumb_html .= '<td valign="top"><input type="checkbox" name="movie[]" value="'.$movie["FILE_ID"].'"></input></td> 
     212    $thumb_html .= '<td valign="top"'.($movie["DETAILS_AVAILABLE"]=='Y' ? '' : ' bgcolor="red"').'><input type="checkbox" name="movie[]" value="'.$movie["FILE_ID"].'"></input></td> 
    213213                    <td valign="middle"><a href="'.$edit_url.'">'.$img_url.'</a></td>'; 
    214     $title_html .= '<td width="25%" colspan="2" align="center" valign="middle"><a href="'.$edit_url.'">'.$movie["TITLE"].'</a></td>'; 
     214    $title_html .= '<td width="25%" colspan="2" align="center" valign="middle"><a href="'.$edit_url.'">'.highlight($movie["TITLE"], $_REQUEST["search"]).'</a></td>'; 
    215215  } 
    216216 
     
    245245    $where .= "and m.title like '%$_REQUEST[search]%' "; 
    246246 
     247  if (!empty($_REQUEST["filter"]) ) 
     248    $where .= "and (m.details_available='N' or m.details_available is null)"; 
     249 
    247250  // If the user has changed category, then shunt them back to page 1. 
    248251  if (un_magic_quote($_REQUEST["last_where"]) != $where) 
     
    261264  message($message); 
    262265 
    263   $this_url = '?last_where='.urlencode($where).'&search='.$_REQUEST["search"].'&cat_id='.$_REQUEST["cat_id"].'&section=MOVIE&action=DISPLAY&page='; 
     266  $this_url = '?last_where='.urlencode($where).'&filter='.$_REQUEST["filter"].'&search='.$_REQUEST["search"].'&cat_id='.$_REQUEST["cat_id"].'&section=MOVIE&action=DISPLAY&page='; 
    264267 
    265268  echo '<form enctype="multipart/form-data" action="" method="post"> 
     
    274277        <img align="absbottom" border="0" src="/images/select_all.gif" onclick=\'handleClick("movie[]", true)\'> 
    275278        <img align="absbottom" border="0" src="/images/select_none.gif" onclick=\'handleClick("movie[]", false)\'> 
     279        <a href="'.url_remove_param($this_url,'filter').'"><img align="absbottom" border="0"  src="/images/filter.gif"></a> 
     280        <a href="'.url_set_param($this_url,'filter','NODETAILS').'"><img align="absbottom" border="0" src="/images/filter_red.gif"></a> 
    276281        </td><td width"50%" align="right"> 
    277282        '.str('SEARCH').' : 
     
    531536    $columns["TITLE"] = $_REQUEST["title"]; 
    532537 
    533   // Update the MOVIES table? 
    534   if (count($columns)>0) 
    535   { 
    536     $columns["DETAILS_AVAILABLE"] = 'Y'; 
    537     scdb_set_movie_attribs($movie_list, $columns); 
    538   } 
    539  
    540538  // Add Actors/Genres/Directors? 
    541539  if ($_REQUEST["update_actors"] == 'yes') 
     
    560558      scdb_add_genres($movie_list,un_magic_quote($_REQUEST["genres"])); 
    561559    if (!empty($_REQUEST["genre_new"])) 
    562       scdb_add_genres($movie_list, explode(',',un_magic_quote($_REQUEST["genre_new"]))); 
    563   } 
    564  
     560      scdb_add_genres($movie_list, explode(',',un_magic_quote($_REQUEST["genre_new"])));     
     561  } 
     562 
     563  // Update the MOVIES attributes 
     564  scdb_set_movie_attribs($movie_list, $columns); 
     565   
    565566  // Process the "Viewed" checkboxes 
    566567  if ($_REQUEST["update_viewed"] == 'yes') 
  • trunk/swisscenter/config/config_tv.php

    r1057 r1098  
    170170 
    171171    echo '<table class="form_select_tab" width="100%"><tr> 
    172           <td valign="top" width="4%"><input type="checkbox" name="tv[]" value="'.$tv["FILE_ID"].'"></input></td> 
     172          <td valign="top" width="4%"'.($tv["DETAILS_AVAILABLE"]=='Y' ? '' : ' bgcolor="red"').'><input type="checkbox" name="tv[]" value="'.$tv["FILE_ID"].'"></input></td> 
    173173          <td valign="top" width="33%"> 
    174              <a href="?section=tv&action=display_info&tv_id='.$tv["FILE_ID"].'">'.$tv["PROGRAMME"].' - '.$tv["TITLE"].'</a><br> 
     174             <a href="?section=tv&action=display_info&tv_id='.$tv["FILE_ID"].'">'.highlight($tv["PROGRAMME"], $_REQUEST["search"]).' - '.highlight($tv["TITLE"], $_REQUEST["search"]).'</a><br> 
    175175             Series : '.nvl($tv["SERIES"]).'<br> 
    176176             Episode : '.nvl($tv["EPISODE"]).'<br> 
     
    202202    $img_url     = img_gen(file_albumart($tv["DIRNAME"].$tv["FILENAME"]) ,130,400,false,false,false,array('hspace'=>0,'vspace'=>4) ); 
    203203    $edit_url    = '?section=tv&action=display_info&tv_id='.$tv["FILE_ID"]; 
    204     $thumb_html .= '<td valign="top"><input type="checkbox" name="tv[]" value="'.$tv["FILE_ID"].'"></input></td> 
     204    $thumb_html .= '<td valign="top"'.($tv["DETAILS_AVAILABLE"]=='Y' ? '' : ' bgcolor="red"').'><input type="checkbox" name="tv[]" value="'.$tv["FILE_ID"].'"></input></td> 
    205205                    <td valign="middle"><a href="'.$edit_url.'">'.$img_url.'</a></td>'; 
    206     $title_html .= '<td width="25%" colspan="2" align="center" valign="middle"><a href="'.$edit_url.'">'.$tv["PROGRAMME"].' - '.$tv["TITLE"].(empty($tv["EPISODE"]) ? '' : str('EPISODE_SUFFIX',$tv["EPISODE"])).'</a></td>'; 
     206    $title_html .= '<td width="25%" colspan="2" align="center" valign="middle"><a href="'.$edit_url.'">'.highlight($tv["PROGRAMME"], $_REQUEST["search"]).' - '.highlight($tv["TITLE"], $_REQUEST["search"]).(empty($tv["EPISODE"]) ? '' : str('EPISODE_SUFFIX',$tv["EPISODE"])).'</a></td>'; 
    207207  } 
    208208 
     
    237237    $where .= "and (t.programme like '%$_REQUEST[search]%' or t.title like '%$_REQUEST[search]%') "; 
    238238 
     239  if (!empty($_REQUEST["filter"]) ) 
     240    $where .= "and (t.details_available='N' or t.details_available is null)"; 
     241 
    239242  // If the user has changed category, then shunt them back to page 1. 
    240243  if (un_magic_quote($_REQUEST["last_where"]) != $where) 
     
    253256  message($message); 
    254257 
    255   $this_url = '?last_where='.urlencode($where).'&search='.$_REQUEST["search"].'&cat_id='.$_REQUEST["cat_id"].'&section=TV&action=DISPLAY&page='; 
     258  $this_url = '?last_where='.urlencode($where).'&filter='.$_REQUEST["filter"].'&search='.$_REQUEST["search"].'&cat_id='.$_REQUEST["cat_id"].'&section=TV&action=DISPLAY&page='; 
    256259 
    257260  echo '<form enctype="multipart/form-data" action="" method="post"> 
     
    266269        <img align="absbottom" border="0" src="/images/select_all.gif" onclick=\'handleClick("tv[]", true)\'> 
    267270        <img align="absbottom" border="0" src="/images/select_none.gif" onclick=\'handleClick("tv[]", false)\'> 
     271        <a href="'.url_remove_param($this_url,'filter').'"><img align="absbottom" border="0"  src="/images/filter.gif"></a> 
     272        <a href="'.url_set_param($this_url,'filter','NODETAILS').'"><img align="absbottom" border="0" src="/images/filter_red.gif"></a> 
    268273        </td><td width"50%" align="right"> 
    269274        '.str('SEARCH').' : 
     
    420425  foreach ( db_toarray("select * from users order by name") as $row) 
    421426    echo '<input type="checkbox" name="viewed[]" value="'.$row["USER_ID"].'" '. 
    422          (viewings_count( 6, $details[0]["FILE_ID"], $row["USER_ID"])>0 ? 'checked' : ''). 
     427         (viewings_count( MEDIA_TYPE_TV, $details[0]["FILE_ID"], $row["USER_ID"])>0 ? 'checked' : ''). 
    423428         '>'.$row["NAME"].'<br>'; 
    424429 
     
    550555    $columns["EPISODE"] = $_REQUEST["episode"]; 
    551556 
    552   // Update the TV table? 
    553   if (count($columns)>0) 
    554   { 
    555     $columns["DETAILS_AVAILABLE"] = 'Y'; 
    556     scdb_set_tv_attribs($tv_list, $columns); 
    557   } 
    558  
    559557  // Add Actors/Genres/Directors? 
    560558  if ($_REQUEST["update_actors"] == 'yes') 
     
    582580  } 
    583581 
     582  // Update the TV attributes 
     583  scdb_set_tv_attribs($tv_list, $columns); 
     584   
    584585  // Process the "Viewed" checkboxes 
    585586  if ($_REQUEST["update_viewed"] == 'yes')