/[drupal]/contributions/modules/moviereview/moviereview.module
ViewVC logotype

Diff of /contributions/modules/moviereview/moviereview.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.8, Mon May 15 23:34:18 2006 UTC revision 1.9, Mon May 29 00:10:34 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: moviereview.module,v 1.7 2006/05/15 02:12:03 emiliano Exp $  // $Id: moviereview.module,v 1.5 2005/11/12 21:28:46 emiliano Exp $
3    
4  // Adapted by Emiliano <emiliano@webinteligente.com.br>  // Adapted by Emiliano <emiliano@novayork.com>
5  // from bookreview module written by Jeremy Andrews <jeremy@kerneltrap.org>  // from bookreview module written by Jeremy Andrews <jeremy@kerneltrap.org>
6    
7  function moviereview_help($section = '') {  function moviereview_help($section = '') {
   $output = '';  
8    switch ($section) {    switch ($section) {
     case 'admin/help#review':  
       $output .= t('Movie Review module allows users, with permission, to submit movie reviews.');  
9      case 'admin/modules#description':      case 'admin/modules#description':
10        $output .= t('Write and publish movie reviews.');        $output .= t('Write and publish movie reviews.');
11        break;        break;
12      case 'node/add#moviereview':      case 'node/add#moviereview':
13        $output = t('Write a movie review.');        $output = t('Write a movie review.');
14        break;        break;
15        case 'node/add/moviereview':
16          $output = variable_get('moviereview_help', '');
17          break;
18    }    }
19    return $output;    return $output;
20  }  }
# Line 42  function moviereview_access($op, $node) Line 42  function moviereview_access($op, $node)
42    }    }
43  }  }
44    
45  function moviereview_node_info() {  function moviereview_node_name() {
46    return array('moviereview' => array('name' => t('movie review'), 'base' => 'moviereview'));    return t('movie review');
47  }  }
48    
49  function moviereview_insert($node) {  function moviereview_insert($node) {
50    
51    db_query("INSERT INTO {moviereview} (nid, movietitle, release, tvseries, cover, genre, director, writer, runtime, country, language, imdb, media, price, rating, review, location) VALUES (%d, '%s', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s')", $node->nid, $node->movietitle,  $node->release,  $node->tvseries, $node->cover, $node->genre,  $node->director,  $node->writer,  $node->runtime,  $node->country, $node->language,  $node->imdb,  $node->media,  $node->price,  $node->rating, $node->review, $node->location);    db_query("INSERT INTO {moviereview} (nid, movietitle, releaseyear, tvseries, cover, genre, director, writer, runtime, country, language, imdb, media, price, rating, review, location) VALUES (%d, '%s', '%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s')", $node->nid, $node->movietitle,  $node->releaseyear,  $node->tvseries, $node->cover, $node->genre,  $node->director,  $node->writer,  $node->runtime,  $node->country, $node->language,  $node->imdb,  $node->media,  $node->price,  $node->rating, $node->review, $node->location);
52    
53    for ($i = 0; $i < $node->numactors; $i++) {    foreach ($node->actors as $weight => $actor) {
54      $actor = "actor-$i";      if ($actor) {
55      if ($node->$actor) {        db_query("INSERT INTO {moviereview_actors} (nid, actor, weight) VALUES (%d, '%s', %d)", $node->nid, $actor, $weight);
       db_query("INSERT INTO {moviereview_actors} (nid, actor, weight) VALUES (%d, '%s', %d)", $node->nid, $node->$actor, $i);  
56      }      }
57    }    }
58      $numlinks = count($node->movielinks);
59    for ($i = 0; $i < $node->numlinks; $i++) {    for ($i = 0; $i < $numlinks; $i++) {
60      $movielink = "movielink-$i";      if ($node->movielinks[$i]) {
61      $linkdescription = "linkdescription-$i";        db_query("INSERT INTO {moviereview_links} (nid, movielink, description, weight) VALUES (%d, '%s', '%s', %d)", $node->nid, $node->movielinks[$i], $node->linkdescriptions[$i], $i);
     if ($node->$movielink) {  
       db_query("INSERT INTO {moviereview_links} (nid, movielink, description, weight) VALUES (%d, '%s', '%s', %d)", $node->nid, $node->$movielink, $node->$linkdescription, $i);  
62      }      }
63    }    }
   
64  }  }
65    
66  function moviereview_load($node) {  function moviereview_load($node) {
# Line 73  function moviereview_load($node) { Line 69  function moviereview_load($node) {
69    while ($actor = db_fetch_object($actors)) {    while ($actor = db_fetch_object($actors)) {
70      $moviereview->actors[$actor->weight] = $actor->actor;      $moviereview->actors[$actor->weight] = $actor->actor;
71    }    }
   $moviereview->numactors = count($moviereview->actors);  
   
72    $movielinks = db_query("SELECT movielink, description, weight FROM {moviereview_links} WHERE nid = '$node->nid' ORDER BY weight");    $movielinks = db_query("SELECT movielink, description, weight FROM {moviereview_links} WHERE nid = '$node->nid' ORDER BY weight");
73    while ($movielink = db_fetch_object($movielinks)) {    while ($movielink = db_fetch_object($movielinks)) {
74      $moviereview->movielinks[$movielink->weight] = $movielink->movielink;      $moviereview->movielinks[$movielink->weight] = $movielink->movielink;
75      $moviereview->linkdescriptions[$movielink->weight] = $movielink->description;      $moviereview->linkdescriptions[$movielink->weight] = $movielink->description;
76    }    }
   $moviereview->numlinks = count($moviereview->movielinks);  
   
77    return $moviereview;    return $moviereview;
78  }  }
79    
80  function moviereview_update($node) {  function moviereview_update($node) {
81    
82    db_query("UPDATE {moviereview} SET movietitle = '%s', release = '%s', tvseries = '%d', cover = '%s', genre = '%s', director = '%s', writer = '%s', runtime = '%s', country = '%s', language = '%s', imdb = '%s', media = '%s', price = '%s', rating = '%d', review = '%s', location = '%s' WHERE nid = %d", $node->movietitle,  $node->release,  $node->tvseries, $node->cover, $node->genre,  $node->director,  $node->writer,  $node->runtime,  $node->country, $node->language,  $node->imdb,  $node->media,  $node->price,  $node->rating, $node->review, $node->location, $node->nid);    db_query("UPDATE {moviereview} SET movietitle = '%s', releaseyear = '%s', tvseries = '%d', cover = '%s', genre = '%s', director = '%s', writer = '%s', runtime = '%s', country = '%s', language = '%s', imdb = '%s', media = '%s', price = '%s', rating = '%d', review = '%s', location = '%s' WHERE nid = %d", $node->movietitle,  $node->releaseyear,  $node->tvseries, $node->cover, $node->genre,  $node->director,  $node->writer,  $node->runtime,  $node->country, $node->language,  $node->imdb,  $node->media,  $node->price,  $node->rating, $node->review, $node->location, $node->nid);
83    
84    db_query("DELETE FROM {moviereview_actors} WHERE nid = %d", $node->nid);    db_query("DELETE FROM {moviereview_actors} WHERE nid = %d", $node->nid);
85    for ($i = 0; $i < $node->numactors; $i++) {    $numactors = count($node->actors);
86      $actor = "actor-$i";    for ($i = 0; $i < $numactors; $i++) {
87      if ($node->$actor) {      if ($node->actors[$i]) {
88        db_query("INSERT INTO {moviereview_actors} (nid, actor, weight) VALUES (%d, '%s', %d)", $node->nid, $node->$actor, $i);        db_query("INSERT INTO {moviereview_actors} (nid, actor, weight) VALUES (%d, '%s', %d)", $node->nid, $node->actors[$i], $i);
89      }      }
90    }    }
91    
92    db_query("DELETE FROM {moviereview_links} WHERE nid = %d", $node->nid);    db_query("DELETE FROM {moviereview_links} WHERE nid = %d", $node->nid);
93    for ($i = 0; $i < $node->numlinks; $i++) {    $numlinks = count($node->movielinks);
94      $movielink = "movielink-$i";    for ($i = 0; $i < $numlinks; $i++) {
95      $linkdescription = "linkdescription-$i";      if ($node->movielinks[$i]) {
96      if ($node->$movielink) {        db_query("INSERT INTO {moviereview_links} (nid, movielink, description, weight) VALUES (%d, '%s', '%s', %d)", $node->nid, $node->movielinks[$i], $node->linkdescriptions[$i], $i);
       db_query("INSERT INTO {moviereview_links} (nid, movielink, description, weight) VALUES (%d, '%s', '%s', %d)", $node->nid, $node->$movielink, $node->$linkdescription, $i);  
97      }      }
98    }    }
   
99  }  }
100    
101  function moviereview_delete($node) {  function moviereview_delete($node) {
# Line 141  function moviereview_validate(&$node) { Line 131  function moviereview_validate(&$node) {
131    return $error;    return $error;
132  }  }
133    
134  function moviereview_form(&$node) {  function moviereview_form(&$node, &$error) {
135    $op = arg(1);    $op = arg(1);
136    $edit = $_POST['edit'];    $edit = $_POST['edit'];
137    
138    //if (function_exists('taxonomy_node_form')) {    if (function_exists('taxonomy_node_form')) {
139    //  $output .= implode('', taxonomy_node_form('moviereview', $node));      $output .= implode('', taxonomy_node_form('moviereview', $node));
   //}  
   
   if ($edit['numactors']) {  
     // It's a preview ...  
     if ($edit['moviereview_more_actors'] == 1) {  
       // ... and we need more actors  
       //if ($edit['numactors'] % 2) {  
       //  $node->numactors = $edit['numactors'] + 1;  
       //}  
       //else {  
         $node->numactors = $edit['numactors'] + 5;  
       //}  
     }  
     else {  
       // we don't want more actors, just see the preview  
       // (numactors may have change with a previous preview)  
       $node->numactors = $edit['numactors'];  
     }  
140    }    }
   elseif(!$node->numactors) {  
     // Just created review, start with one author.  
     $node->numactors = 5;  
   }  
141    
142  //  if ($edit['moviereview_more_actors'] == 1) {    if ($edit['moviereview_more_actors'] == 1) {
143  //    $node->numactors = $node->numactors + 5;      $node->numactors = $node->numactors + 5;
144  //  }    }
145  //  elseif ($node->actors) {    elseif ($node->actors) {
146  //    $node->numactors = count($node->actors);      $node->numactors = count($node->actors);
147  //  }    }
148  //  else {    else {
149  //    $node->numactors = 5;      $node->numactors = 5;
150  //  }    }
151    if ($edit['moviereview_more_links'] == 1) {    if ($edit['moviereview_more_links'] == 1) {
152      $node->numlinks = $node->numlinks + 5;      $node->numlinks = $node->numlinks + 5;
153    }    }
# Line 190  function moviereview_form(&$node) { Line 158  function moviereview_form(&$node) {
158      $node->numlinks = 3;      $node->numlinks = 3;
159    }    }
160    
161    $form['numactors'] = array(    $output .= form_hidden('numactors', $node->numactors);
162      '#type' => 'hidden',    $output .= form_hidden('numlinks', $node->numlinks);
163      '#value' => $node->numactors,  
164    );    $output .= '<div id="moviereview-form">' . form_textfield(t('Movie title'), 'movietitle', $node->movietitle, 60, 255, t('The title of the movie being reviewed, if different than the title of this movie review.'));
165      $output .= form_textfield(t('Release year'), 'releaseyear', $node->releaseyear, 4, 255, t('The year the movie was released.  (Format:  YYYY).'));
166    $form['numlinks'] = array(    $output .= form_checkbox(t('Tv series'), 'tvseries', 1, $node->tvseries, t('Is this a tv series?'));
167      '#type' => 'hidden',    $output .= form_textfield(t('Cover picture'), 'cover', $node->cover, 60, 255, t('URL of movie cover image.'));
168      '#value' => $node->numlinks,    $output .= form_textfield(t('Genre'), 'genre', $node->genre, 60, 255, t('Genre of the movie.'));
169    );    $output .= form_textfield(t('Director'), 'director', $node->director, 60, 255, t('Director(s) of the movie.'));
170      $output .= form_textfield(t('Writer'), 'writer', $node->writer, 60, 255, t('Writing credits.'));
171    $form['title'] = array(  
172      '#type' => 'textfield',    $output .= form_item(t('Actor(s)'), '');
     '#title' => t('Title'),  
     '#default_value' => $node->title,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('The title of the movie being reviewed.'),  
   );  
   
 //  $form['movietitle'] = array(  
 //    '#type' => 'textfield',  
 //    '#title' => t('Movie title'),  
 //    '#default_value' => $node->movietitle,  
 //    '#size' => 60,  
 //    '#maxlength' => 255,  
 //    '#description' => t('The title of the movie being reviewed, if different than the title of this movie review.'),  
 //    '#prefix' => '<div id="moviereview-form">',  
 //  );  
   
   $form['release'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Release year'),  
     '#default_value' => $node->release,  
     '#size' => 4,  
     '#maxlength' => 255,  
     '#description' => t('The year the movie was released.  (Format:  YYYY).'),  
   );  
   
   $form['tvseries'] = array(  
     '#type' => 'checkbox',  
     '#title' => t('Tv series'),  
     '#return_value' => 1,  
     '#default_value' => $node->tvseries,  
     '#description' => t('Is this a tv series?'),  
   );  
   
   $form['cover'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Cover picture'),  
     '#default_value' => $node->cover,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('URL of movie cover image.'),  
   );  
   
   $form['genre'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Genre'),  
     '#default_value' => $node->genre,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('Genre of the movie.'),  
   );  
   
   $form['director'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Director'),  
     '#default_value' => $node->director,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('Director(s) of the movie.'),  
   );  
   
   $form['writer'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Writer'),  
     '#default_value' => $node->writer,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('Writing credits.'),  
   );  
   
   $form[] = array(  
     '#type' => 'item',  
     '#title' => t('Actor(s)'),  
     '#default_value' => '',  
   );  
   
173    for ($i = 0; $i < $node->numactors; $i++) {    for ($i = 0; $i < $node->numactors; $i++) {
174      $form["actor-$i"] = array(      $output .= form_textfield('', "actors][$i", $node->actors[$i], 60, 255, '');
175        '#type' => 'textfield',    }
176        '#title' => '',  
177        '#default_value' => $node->actors[$i],    $output .= form_checkbox(t('add more actors'), 'moviereview_more_actors', 1, 0, t('You can create space to list more actors by checking this box and clicking '). '<b>'. t('Preview'). '</b>.');
178        '#size' => 60,  
179        '#maxlength' => 255,    $output .= form_textfield(t('Runtime'), 'runtime', $node->runtime, 60, 255, t('The movie run time.'));
180        '#description' => '',    $output .= form_textfield(t('Country'), 'country', $node->country, 60, 255, t('Country of movie production.'));
181      );    $output .= form_textfield(t('Language'), 'language', $node->language, 60, 255, t('Language of the movie.'));
182    }    $output .= form_textfield(t('Imdb'), 'imdb', $node->imdb, 60, 255, t('Imdb id of the movie'));
183      $output .= form_textfield(t('Media'), 'media', $node->media, 60, 255, t('Media in which the movie is available'));
184    $form['moviereview_more_actors'] = array(    $output .= form_textfield(t('Price'), 'price', $node->price, 60, 255, t('The cost of the movie being reviewed.'));
185      '#type' => 'checkbox',    $output .= form_select(t('Rating'), 'rating', $node->rating, (array("<" . t('none') . ">") + drupal_map_assoc(range(1, 10))), t('Score of the movie on a 1 to 10 scale.'));
186      '#title' => t('add more actors'),  
187      '#return_value' => 1,    $output .= form_textarea(t('Synopsis'), 'body', $node->body, 60, 18, t('A synopsis of the movie being reviewed.'));
     '#default_value' => 0,  
     '#description' => t('You can create space to list more actors by checking this box and clicking '). '<b>'. t('Preview'). '</b>.',  
   );  
   
   $form['runtime'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Runtime'),  
     '#default_value' => $node->runtime,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('The movie run time.'),  
   );  
   
   $form['country'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Country'),  
     '#default_value' => $node->country,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('Country of movie production.'),  
   );  
   
   $form['language'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Language'),  
     '#default_value' => $node->language,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('Language of the movie.'),  
   );  
   
   $form['imdb'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Imdb'),  
     '#default_value' => $node->imdb,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('Imdb id of the movie'),  
   );  
   
   $form['media'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Media'),  
     '#default_value' => $node->media,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('Media in which the movie is available'),  
   );  
   
   $form['price'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Price'),  
     '#default_value' => $node->price,  
     '#size' => 60,  
     '#maxlength' => 255,  
     '#description' => t('The cost of the movie being reviewed.'),  
   );  
   
   $form['rating'] = array(  
     '#type' => 'select',  
     '#title' => t('Rating'),  
     '#default_value' => $node->rating,  
     '#options' => (array("<" . t('none') . ">") + drupal_map_assoc(range(1, 10))),  
     '#description' => t('Score of the movie on a 1 to 10 scale.'),  
   );  
   
   $form['body'] = array(  
     '#type' => 'textarea',  
     '#title' => t('Synopsis'),  
     '#default_value' => $node->body,  
     '#cols' => 60,  
     '#rows' => 18,  
     '#description' => t('A synopsis of the movie being reviewed.'),  
   );  
   
188    // Only display this field if longer input format was choosen    // Only display this field if longer input format was choosen
189    if (variable_get('moviereview_detail', 0) == 0) {    if (variable_get('moviereview_detail', 0) == 0) {
190      $form['location'] = array(      $output .= form_textarea(t('Location'), 'location', $node->location, 60, 18, t('Filming location.'));
191        '#type' => 'textarea',    }
192        '#title' => t('Location'),    $output .= form_textarea(t('Review'), 'review', $node->review, 60, 18, t('This is the actual movie review.'));
193        '#default_value' => $node->location,  
194        '#cols' => 60,    $output .= form_item(t('Offsite links'), '');
       '#rows' => 18,  
       '#description' => t('Filming location.'),  
     );  
   }  
   
   $form['review'] = array(  
     '#type' => 'textarea',  
     '#title' => t('Review'),  
     '#default_value' => $node->review,  
     '#cols' => 60,  
     '#rows' => 18,  
     '#description' => t('This is the actual movie review.'),  
   );  
   
 //  $form[] = array(  
 //    '#type' => 'item',  
 //    '#title' => t('Offsite links'),  
 //    '#default_value' => '',  
 //  );  
   
195    // TODO:  Replace table formatting with css    // TODO:  Replace table formatting with css
196  //  $output .= '<div id="mr_links">'."<table>\n";    $output .= '<div id="mr_links">'."<table>\n";
 //  for ($i = 0; $i < $node->numlinks; $i++) {  
 //    $output .= "  <tr><td>\n";  
 //    $output .= form_textfield(t('URL'), "movielinks][$i", $node->movielinks[$i], 45, 255, '');  
 //    $output .= "  </td><td>\n";  
 //    $output .= form_textfield(t('Description'), "linkdescriptions][$i", $node->linkdescriptions[$i], 45, 255, '');  
 //    $output .= "  </td></tr>\n";  
 //  }  
 //  $output .= "</table></div>\n";  
 //  $output .= form_checkbox(t('add more links'), 'moviereview_more_links', 1, 0, t('If you need to add more links, check this box and click '). '<b>'. t('Preview'). '</b>.');  
 //  $output .= "</div>";  
 //  $output .= filter_form('format', $node->format);  
   
 //  return $output;  
 //}  
   
   $form['offsite_links'] = array(  
     '#type' => 'fieldset',  
     '#title' => t('Offsite links'),  
     '#collapsible' => TRUE,  
     '#collapsed' => TRUE,  
   );  
   
   $form['offsite_links']['movielinks_begin'] = array(  
       '#type' => 'markup',  
       '#value' => '<table>',  
   );  
197    for ($i = 0; $i < $node->numlinks; $i++) {    for ($i = 0; $i < $node->numlinks; $i++) {
198      $form['offsite_links']["movielink-$i"] = array(      $output .= "  <tr><td>\n";
199        '#type' => 'textfield',      $output .= form_textfield(t('URL'), "movielinks][$i", $node->movielinks[$i], 45, 255, '');
200        '#title' => 'URL',      $output .= "  </td><td>\n";
201        '#default_value' => $node->movielinks[$i],      $output .= form_textfield(t('Description'), "linkdescriptions][$i", $node->linkdescriptions[$i], 45, 255, '');
202        '#size' => 45,      $output .= "  </td></tr>\n";
203        '#maxlength' => 255,    }
204        '#description' => '',    $output .= "</table></div>\n";
205        '#prefix' => '<tr><td>',    $output .= form_checkbox(t('add more links'), 'moviereview_more_links', 1, 0, t('If you need to add more links, check this box and click '). '<b>'. t('Preview'). '</b>.');
206        '#suffix' => '</td>',    $output .= "</div>";
207      );    $output .= filter_form('format', $node->format);
     $form['offsite_links']["linkdescription-$i"] = array(  
       '#type' => 'textfield',  
       '#title' => 'Description',  
       '#default_value' => $node->linkdescriptions[$i],  
       '#size' => 45,  
       '#maxlength' => 255,  
       '#description' => '',  
       '#prefix' => '<td>',  
       '#suffix' => '</td></tr>',  
     );  
   }  
   $form['offsite_links']['movielinks_end'] = array(  
       '#type' => 'markup',  
       '#value' => '</table>',  
   );  
   
   $form['offsite_links']['moviereview_more_links'] = array(  
     '#type' => 'checkbox',  
     '#title' => t('add more links'),  
     '#value' => 0,  
     '#description' => t('If you need to add more links, check this box and click '). '<strong>'. t('Preview'). '</strong>.',  
   );  
   
   $form['format'] = filter_form($node->format);  
208    
209    return $form;    return $output;
   
210  }  }
211    
   
212  function moviereview_menu($may_cache) {  function moviereview_menu($may_cache) {
213    $items = array();    $items = array();
214    
# Line 490  function moviereview_settings() { Line 235  function moviereview_settings() {
235    if (!file_check_location(variable_get('moviereview_css', 'modules/moviereview/moviereview.css'))) {    if (!file_check_location(variable_get('moviereview_css', 'modules/moviereview/moviereview.css'))) {
236      $error['moviereview_css'] = theme('error', t('File does not exist, or is not readable.'));      $error['moviereview_css'] = theme('error', t('File does not exist, or is not readable.'));
237    }    }
238      $output = form_textfield(t('Style sheet'), "moviereview_css", variable_get('moviereview_css', 'modules/moviereview/moviereview.css'), 70, 255, t("Specify the relative path to your moviereview style sheet.  The style sheet specified here will be used to style your moviereview pages.  If you prefer to style your moviereview pages in your theme, you can leave this field blank. ". $error['moviereview_css']));
239    $form['moviereview_settings'] = array(    $output .= form_radios(t('Details to collect'), 'moviereview_detail', variable_get('moviereview_detail', 0), array(t('Synopsis, Location and Review'), t('Synopsis and Review only')), t('Details you would like to collect about the movies as freeform text.'));
240      '#type' => 'fieldset',    $output .= form_textarea(t('Explanation or submission guidelines'), 'moviereview_help', variable_get('moviereview_help', ''), 55, 4, t('This text will be displayed at the top of the movie review submission form.  Useful for helping or instructing your users.'));
241      '#title' => t('Moviereview settings'),    $output .= form_select(t('Minimum number of words'), 'minimum_moviereview_size', variable_get('minimum_moviereview_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200, 500, 1000)), t('The minimum number of words a movie review must have to be considered valid.  This can be useful to prevent submissions that do not meet the site\'s standards, such as short test posts.'));
242    );    return $output;
   
   $form['moviereview_settings']['stylesheet'] = array(  
     '#type' => 'textfield',  
     '#title' => t('Style sheet'),  
     '#default_value' => variable_get('moviereview_css', 'modules/moviereview/moviereview.css'),  
     '#size' => 70,  
     '#maxlength' => 255,  
     '#description' => t("Specify the relative path to your moviereview style sheet.  The style sheet specified here will be used to style your moviereview pages.  If you prefer to style your moviereview pages in your theme, you can leave this field blank. ". $error['moviereview_css']),  
   );  
   
   $form['moviereview_settings']['moviereview_detail'] = array(  
     '#type' => 'radios',  
     '#title' => t('Details to collect'),  
     '#default_value' => variable_get('moviereview_detail', 0),  
     '#options' => array(t('Synopsis, Location and Review'), t('Synopsis and Review only')),  
     '#description' => t('Details you would like to collect about the movies as freeform text.'),  
   );  
   
   $form['moviereview_settings']['moviereview_help'] = array(  
     '#type' => 'textarea',  
     '#title' => t('Explanation or submission guidelines'),  
     '#default_value' => variable_get('moviereview_help', ''),  
     '#cols' => 55,  
     '#rows' => 4,  
     '#description' => t('This text will be displayed at the top of the movie review submission form.  Useful for helping or instructing your users.'),  
   );  
   
   $form['minimum_moviereview_size'] = array(  
     '#type' => 'select',  
     '#title' => t('Minimum number of words'),  
     '#default_value' => variable_get('minimum_moviereview_size', 0),  
     '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200, 500, 1000)),  
     '#description' => t('The minimum number of words a movie review must have to be considered valid.  This can be useful to prevent submissions that do not meet the site\'s standards, such as short test posts.'),  
   );  
   
   return $form;  
243  }  }
244    
245  function moviereview_page() {  function moviereview_page() {
# Line 548  function moviereview_overview() { Line 257  function moviereview_overview() {
257    
258  function theme_moviereview_list() {  function theme_moviereview_list() {
259    
260    $header = array('&nbsp;', array('data' => t('Title'), 'field' => 'n.title', 'sort' => 'asc', 'width' => '40%'), array('data' => t('Year'), 'field' => 'm.release', '', 'width' => '20%'), array('data' => t('Rating'), 'field' => 'm.rating', '', 'width' => '20%'));    $header = array('&nbsp;', array('data' => t('Title'), 'field' => 'n.title', 'sort' => 'asc', 'width' => '40%'), array('data' => t('Year'), 'field' => 'm.releaseyear', '', 'width' => '20%'), array('data' => t('Rating'), 'field' => 'm.rating', '', 'width' => '20%'));
261    
262    $sql = db_rewrite_sql('SELECT DISTINCT(n.nid), n.title, m.movietitle, m.cover, m.director, m.genre, m.release, m.runtime, m.rating, m.imdb, m.price FROM {moviereview} m INNER JOIN {node} n ON m.nid = n.nid WHERE n.status = 1');    $sql = db_rewrite_sql('SELECT DISTINCT(n.nid), n.title, m.movietitle, m.cover, m.director, m.genre, m.releaseyear, m.runtime, m.rating, m.imdb, m.price FROM {moviereview} m INNER JOIN {node} n ON m.nid = n.nid WHERE n.status = 1');
263    $sql .= tablesort_sql($header);    $sql .= tablesort_sql($header);
264    $result = pager_query($sql, 20);    $result = pager_query($sql, 20);
265    
# Line 580  function theme_moviereview_list() { Line 289  function theme_moviereview_list() {
289      if ($node->director) {      if ($node->director) {
290        $output .= t('<b>Directed by:</b> %director', array('%director' => $node->director)) .'<br />';        $output .= t('<b>Directed by:</b> %director', array('%director' => $node->director)) .'<br />';
291      }      }
292      if ($node->release) {      if ($node->releaseyear) {
293        $output .= t('<b>Year:</b> %release', array('%release' => $node->release)) .'<br />';        $output .= t('<b>Year:</b> %releaseyear', array('%releaseyear' => $node->releaseyear)) .'<br />';
294      }      }
295      if ($node->runtime) {      if ($node->runtime) {
296        $output .= t('<b>Runtime:</b> %runtime', array('%runtime' => $node->runtime)) .'<br />';        $output .= t('<b>Runtime:</b> %runtime', array('%runtime' => $node->runtime)) .'<br />';
# Line 683  function theme_moviereview_content(&$nod Line 392  function theme_moviereview_content(&$nod
392      }      }
393    }    }
394    
395    if($node->release) {    if($node->releaseyear) {
396      $output .= "    <div class=\"label2\">". t('Year') .": </div><div class=\"content2\">". $node->release ."</div>\n";      $output .= "    <div class=\"label2\">". t('Year') .": </div><div class=\"content2\">". $node->releaseyear ."</div>\n";
397    }    }
398    if($node->country) {    if($node->country) {
399      $output .= "    <div class=\"label2\">". t('Country') .": </div><div class=\"content2\">". $node->country ."</div>\n";      $output .= "    <div class=\"label2\">". t('Country') .": </div><div class=\"content2\">". $node->country ."</div>\n";
# Line 719  function theme_moviereview_content(&$nod Line 428  function theme_moviereview_content(&$nod
428    if($node->body) {    if($node->body) {
429      $output .= "  <div class=\"synopsis\">\n";      $output .= "  <div class=\"synopsis\">\n";
430      $output .= "    <span class=\"label4\">". t('Synopsis') ."</span><br />\n";      $output .= "    <span class=\"label4\">". t('Synopsis') ."</span><br />\n";
431      $output .= "    <span class=\"content2\">". check_markup($node->body, $node->format) ."</span>\n";      $output .= "    <span class=\"content2\">". check_output($node->body, $node->format) ."</span>\n";
432      $output .= "  </div><br />\n";      $output .= "  </div><br />\n";
433    }    }
434    if($node->location) {    if($node->location) {
435      $output .= "  <div class=\"location\">\n";      $output .= "  <div class=\"location\">\n";
436      $output .= "    <span class=\"label4\">". t('Location') ."</span><br />\n";      $output .= "    <span class=\"label4\">". t('Location') ."</span><br />\n";
437      $output .= "    <span class=\"content2\">". check_markup($node->location, $node->format) ."</span>\n";      $output .= "    <span class=\"content2\">". check_output($node->location, $node->format) ."</span>\n";
438      $output .= "  </div><br />\n";      $output .= "  </div><br />\n";
439    }    }
440    if($node->review) {    if($node->review) {
441      $output .= "  <div class=\"review\">\n";      $output .= "  <div class=\"review\">\n";
442      $output .= "    <span class=\"label4\">". t('Review') ."</span><br />\n";      $output .= "    <span class=\"label4\">". t('Review') ."</span><br />\n";
443      $output .= "    <span class=\"content2\">". check_markup($node->review, $node->format) ."</span>\n";      $output .= "    <span class=\"content2\">". check_output($node->review, $node->format) ."</span>\n";
444      $output .= "  </div><br />\n";      $output .= "  </div><br />\n";
445    }    }
446    if($node->movielinks[0]) {    if($node->movielinks[0]) {
# Line 743  function theme_moviereview_content(&$nod Line 452  function theme_moviereview_content(&$nod
452        $linkdescription = $node->linkdescriptions[$i] ? $node->linkdescriptions[$i] : $node->movielinks[$i];        $linkdescription = $node->linkdescriptions[$i] ? $node->linkdescriptions[$i] : $node->movielinks[$i];
453        if(ereg('^http://|^https://|ftp://',"$movielink")) {        if(ereg('^http://|^https://|ftp://',"$movielink")) {
454          // off site link          // off site link
455          $movielink = "<a href=\"$movielink\">". check_markup($linkdescription, $node->format) .'</a>';          $movielink = "<a href=\"$movielink\">". check_output($linkdescription, $node->format) .'</a>';
456        }        }
457        elseif($movielink) {        elseif($movielink) {
458          // on site link          // on site link
459          $movielink = l("$linkdescription", "$movielink");          $movielink = l("$linkdescription", "$movielink");
460        }        }
461        $output .= "    <span class=\"content2\">". check_markup($movielink, $node->format) ."</span>\n";        $output .= "    <span class=\"content2\">". check_output($movielink, $node->format) ."</span>\n";
462      }      }
463      $output .= "  </div>\n";      $output .= "  </div>\n";
464    }    }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.2