/[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.6.2.5, Sun May 28 23:34:48 2006 UTC revision 1.6.2.6, Tue Sep 12 03:52:30 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: moviereview.module,v 1.6.2.4 2006/05/15 23:35:20 emiliano Exp $  // $Id: moviereview.module,v 1.6.2.5 2006/05/28 23:34:48 emiliano Exp $
3    
4  // Adapted by Emiliano <emiliano@webinteligente.com.br>  // Adapted by Emiliano <emiliano@webinteligente.com.br>
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 = '') {
8    $output = '';    $output = '';
9    switch ($section) {    switch ($section) {
10      case 'admin/help#review':      case 'admin/help#review':
11        $output .= t('Movie Review module allows users, with permission, to submit movie reviews.');        $output .= t('Movie Review module allows users, with permission, to submit movie reviews.');
12      case 'admin/modules#description':      case 'admin/modules#description':
13        $output .= t('Write and publish movie reviews.');        $output .= t('Write and publish movie reviews.');
14        break;        break;
15      case 'node/add#moviereview':      case 'node/add#moviereview':
16        $output = t('Write a movie review.');        $output = t('Write a movie review.');
17        break;        break;
18    }    }
19    return $output;    return $output;
20  }  }
21    
22  function moviereview_perm() {  function moviereview_perm() {
23    return array('access moviereviews', 'create moviereviews');    return array('access moviereviews', 'create moviereviews');
24  }  }
25    
26  function moviereview_access($op, $node) {  function moviereview_access($op, $node) {
27    
28    global $user;    global $user;
29    
30    if ($op == 'view' && user_access('access moviereviews')) {    if ($op == 'view' && user_access('access moviereviews')) {
31      return $node->status;      return $node->status;
32    }    }
33    
34    if ($op == 'create') {    if ($op == 'create') {
35      return user_access('create moviereviews');      return user_access('create moviereviews');
36    }    }
37    
38    if ($op == 'update' || $op == 'delete') {    if ($op == 'update' || $op == 'delete') {
39      if (user_access('create moviereviews') && ($user->uid == $node->uid)) {      if (user_access('create moviereviews') && ($user->uid == $node->uid)) {
40        return TRUE;        return TRUE;
41      }      }
42    }    }
43  }  }
44    
45  function moviereview_node_info() {  function moviereview_node_info() {
46    return array('moviereview' => array('name' => t('movie review'), 'base' => 'moviereview'));    return array('moviereview' => array('name' => t('movie review'), 'base' => 'moviereview'));
47  }  }
48    
49  function moviereview_insert($node) {  function moviereview_insert($node) {
50    
51    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);    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++) {    for ($i = 0; $i < $node->numactors; $i++) {
54      $actor = "actor-$i";      $actor = "actor-$i";
55      if ($node->$actor) {      if ($node->$actor) {
56        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->$actor, $i);
57      }      }
58    }    }
59    
60    for ($i = 0; $i < $node->numlinks; $i++) {    for ($i = 0; $i < $node->numlinks; $i++) {
61      $movielink = "movielink-$i";      $movielink = "movielink-$i";
62      $linkdescription = "linkdescription-$i";      $linkdescription = "linkdescription-$i";
63      if ($node->$movielink) {      if ($node->$movielink) {
64        db_query("INSERT INTO {moviereview_links} (nid, movielink, description, weight) VALUES (%d, '%s', '%s', %d)", $node->nid, $node->$movielink, $node->$linkdescription, $i);        db_query("INSERT INTO {moviereview_links} (nid, movielink, description, weight) VALUES (%d, '%s', '%s', %d)", $node->nid, $node->$movielink, $node->$linkdescription, $i);
65      }      }
66    }    }
67    
68  }  }
69    
70  function moviereview_load($node) {  function moviereview_load($node) {
71    $moviereview = db_fetch_object(db_query("SELECT * FROM {moviereview} WHERE nid = '$node->nid'"));    $moviereview = db_fetch_object(db_query("SELECT * FROM {moviereview} WHERE nid = '$node->nid'"));
72    $actors = db_query("SELECT actor, weight FROM {moviereview_actors} WHERE nid = '$node->nid' ORDER BY weight");    $actors = db_query("SELECT actor, weight FROM {moviereview_actors} WHERE nid = '$node->nid' ORDER BY weight");
73    while ($actor = db_fetch_object($actors)) {    while ($actor = db_fetch_object($actors)) {
74      $moviereview->actors[$actor->weight] = $actor->actor;      $moviereview->actors[$actor->weight] = $actor->actor;
75    }    }
76    $moviereview->numactors = count($moviereview->actors);    $moviereview->numactors = count($moviereview->actors);
77    
78    $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");
79    while ($movielink = db_fetch_object($movielinks)) {    while ($movielink = db_fetch_object($movielinks)) {
80      $moviereview->movielinks[$movielink->weight] = $movielink->movielink;      $moviereview->movielinks[$movielink->weight] = $movielink->movielink;
81      $moviereview->linkdescriptions[$movielink->weight] = $movielink->description;      $moviereview->linkdescriptions[$movielink->weight] = $movielink->description;
82    }    }
83    $moviereview->numlinks = count($moviereview->movielinks);    $moviereview->numlinks = count($moviereview->movielinks);
84    
85    return $moviereview;    return $moviereview;
86  }  }
87    
88  function moviereview_update($node) {  function moviereview_update($node) {
89    
90    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);    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);
91    
92    db_query("DELETE FROM {moviereview_actors} WHERE nid = %d", $node->nid);    db_query("DELETE FROM {moviereview_actors} WHERE nid = %d", $node->nid);
93    for ($i = 0; $i < $node->numactors; $i++) {    for ($i = 0; $i < $node->numactors; $i++) {
94      $actor = "actor-$i";      $actor = "actor-$i";
95      if ($node->$actor) {      if ($node->$actor) {
96        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->$actor, $i);
97      }      }
98    }    }
99    
100    db_query("DELETE FROM {moviereview_links} WHERE nid = %d", $node->nid);    db_query("DELETE FROM {moviereview_links} WHERE nid = %d", $node->nid);
101    for ($i = 0; $i < $node->numlinks; $i++) {    for ($i = 0; $i < $node->numlinks; $i++) {
102      $movielink = "movielink-$i";      $movielink = "movielink-$i";
103      $linkdescription = "linkdescription-$i";      $linkdescription = "linkdescription-$i";
104      if ($node->$movielink) {      if ($node->$movielink) {
105        db_query("INSERT INTO {moviereview_links} (nid, movielink, description, weight) VALUES (%d, '%s', '%s', %d)", $node->nid, $node->$movielink, $node->$linkdescription, $i);        db_query("INSERT INTO {moviereview_links} (nid, movielink, description, weight) VALUES (%d, '%s', '%s', %d)", $node->nid, $node->$movielink, $node->$linkdescription, $i);
106      }      }
107    }    }
108    
109  }  }
110    
111  function moviereview_delete($node) {  function moviereview_delete($node) {
112    db_query("DELETE FROM {moviereview} WHERE nid = %d", $node->nid);    db_query("DELETE FROM {moviereview} WHERE nid = %d", $node->nid);
113    db_query("DELETE FROM {moviereview_actors} WHERE nid = %d", $node->nid);    db_query("DELETE FROM {moviereview_actors} WHERE nid = %d", $node->nid);
114    db_query("DELETE FROM {moviereview_links} WHERE nid = %d", $node->nid);    db_query("DELETE FROM {moviereview_links} WHERE nid = %d", $node->nid);
115  }  }
116    
117  function moviereview_validate(&$node) {  function moviereview_submit(&$node) {
118      if (variable_get('teaser_length', 600)) {
119    if (variable_get('teaser_length', 600)) {      if ($node->body) {
120      if ($node->body) {        $node->teaser = check_markup(node_teaser($node->body), $node->format);
121        $node->teaser = node_teaser($node->body);      }
122      }      else {
123      else {        $node->teaser = check_markup(node_teaser($node->review), $node->format);
124        $node->teaser = node_teaser($node->review);      }
125      }    }
126    }    else {
127    else {      // teasers are disabled, display whole moviereview
128      // teasers are disabled, display whole movie review      $node->teaser = check_markup($node->review, $node->format);
129      $node->teaser = $node->body;    }
130    }  }
131    
132    if (isset($node->review)) {  function moviereview_validate(&$node) {
133      $word_count = count(explode(' ', $node->review));  
134      if ($word_count < variable_get('minimum_moviereview_size', 0)) {    if (isset($node->review)) {
135        $error['review'] = theme('error', t('The body of your movie review is too short.  You are required to enter at least %minimum_word_count words, but you\'ve only entered %word_count.', array('%minimum_word_count' => variable_get('minimum_moviereview_size', 0), '%word_count' => $word_count)));      $word_count = count(explode(' ', $node->review));
136      }      if ($word_count < variable_get('minimum_moviereview_size', 0)) {
137      else if (!$node->review) {        $error['review'] = theme('error', t('The body of your movie review is too short.  You are required to enter at least %minimum_word_count words, but you\'ve only entered %word_count.', array('%minimum_word_count' => variable_get('minimum_moviereview_size', 0), '%word_count' => $word_count)));
138        $error['review'] = theme('error', t('You are required to enter text for your movie review.'));      }
139      }      else if (!$node->review) {
140    }        $error['review'] = theme('error', t('You are required to enter text for your movie review.'));
141    return $error;      }
142  }    }
143      return $error;
144  function moviereview_form(&$node) {  }
145    $op = arg(1);  
146    $edit = $_POST['edit'];  function moviereview_form(&$node) {
147      $op = arg(1);
148    //if (function_exists('taxonomy_node_form')) {    $edit = $_POST['edit'];
149    //  $output .= implode('', taxonomy_node_form('moviereview', $node));  
150    //}    //if (function_exists('taxonomy_node_form')) {
151      //  $output .= implode('', taxonomy_node_form('moviereview', $node));
152    if ($edit['numactors']) {    //}
153      // It's a preview ...  
154      if ($edit['moviereview_more_actors'] == 1) {    if ($edit['numactors']) {
155        // ... and we need more actors      // It's a preview ...
156        //if ($edit['numactors'] % 2) {      if ($edit['moviereview_more_actors'] == 1) {
157        //  $node->numactors = $edit['numactors'] + 1;        // ... and we need more actors
158        //}        //if ($edit['numactors'] % 2) {
159        //else {        //  $node->numactors = $edit['numactors'] + 1;
160          $node->numactors = $edit['numactors'] + 5;        //}
161        //}        //else {
162      }          $node->numactors = $edit['numactors'] + 5;
163      else {        //}
164        // we don't want more actors, just see the preview      }
165        // (numactors may have change with a previous preview)      else {
166        $node->numactors = $edit['numactors'];        // we don't want more actors, just see the preview
167      }        // (numactors may have change with a previous preview)
168    }        $node->numactors = $edit['numactors'];
169    elseif(!$node->numactors) {      }
170      // Just created review, start with one author.    }
171      $node->numactors = 5;    elseif(!$node->numactors) {
172    }      // Just created review, start with one author.
173        $node->numactors = 5;
174  //  if ($edit['moviereview_more_actors'] == 1) {    }
175  //    $node->numactors = $node->numactors + 5;  
176  //  }  //  if ($edit['moviereview_more_actors'] == 1) {
177  //  elseif ($node->actors) {  //    $node->numactors = $node->numactors + 5;
178  //    $node->numactors = count($node->actors);  //  }
179  //  }  //  elseif ($node->actors) {
180  //  else {  //    $node->numactors = count($node->actors);
181  //    $node->numactors = 5;  //  }
182  //  }  //  else {
183    if ($edit['moviereview_more_links'] == 1) {  //    $node->numactors = 5;
184      $node->numlinks = $node->numlinks + 5;  //  }
185    }    if ($edit['moviereview_more_links'] == 1) {
186    elseif ($node->movielinks) {      $node->numlinks = $node->numlinks + 5;
187      $node->numlinks = count($node->movielinks);    }
188    }    elseif ($node->movielinks) {
189    else {      $node->numlinks = count($node->movielinks);
190      $node->numlinks = 3;    }
191    }    else {
192        $node->numlinks = 3;
193    $form['numactors'] = array(    }
194      '#type' => 'hidden',  
195      '#value' => $node->numactors,    $form['numactors'] = array(
196    );      '#type' => 'hidden',
197        '#value' => $node->numactors,
198    $form['numlinks'] = array(    );
199      '#type' => 'hidden',  
200      '#value' => $node->numlinks,    $form['numlinks'] = array(
201    );      '#type' => 'hidden',
202        '#value' => $node->numlinks,
203    $form['title'] = array(    );
204      '#type' => 'textfield',  
205      '#title' => t('Title'),    $form['title'] = array(
206      '#default_value' => $node->title,      '#type' => 'textfield',
207      '#size' => 60,      '#title' => t('Title'),
208      '#maxlength' => 255,      '#default_value' => $node->title,
209      '#description' => t('The title of the movie being reviewed.'),      '#size' => 60,
210    );      '#maxlength' => 255,
211        '#description' => t('The title of the movie being reviewed.'),
212  //  $form['movietitle'] = array(    );
213  //    '#type' => 'textfield',  
214  //    '#title' => t('Movie title'),  //  $form['movietitle'] = array(
215  //    '#default_value' => $node->movietitle,  //    '#type' => 'textfield',
216  //    '#size' => 60,  //    '#title' => t('Movie title'),
217  //    '#maxlength' => 255,  //    '#default_value' => $node->movietitle,
218  //    '#description' => t('The title of the movie being reviewed, if different than the title of this movie review.'),  //    '#size' => 60,
219  //    '#prefix' => '<div id="moviereview-form">',  //    '#maxlength' => 255,
220  //  );  //    '#description' => t('The title of the movie being reviewed, if different than the title of this movie review.'),
221    //    '#prefix' => '<div id="moviereview-form">',
222    $form['releaseyear'] = array(  //  );
223      '#type' => 'textfield',  
224      '#title' => t('Release year'),    $form['releaseyear'] = array(
225      '#default_value' => $node->releaseyear,      '#type' => 'textfield',
226      '#size' => 4,      '#title' => t('Release year'),
227      '#maxlength' => 255,      '#default_value' => $node->releaseyear,
228      '#description' => t('The year the movie was released.  (Format:  YYYY).'),      '#size' => 4,
229    );      '#maxlength' => 255,
230        '#description' => t('The year the movie was released.  (Format:  YYYY).'),
231    $form['tvseries'] = array(    );
232      '#type' => 'checkbox',  
233      '#title' => t('Tv series'),    $form['tvseries'] = array(
234      '#return_value' => 1,      '#type' => 'checkbox',
235      '#default_value' => $node->tvseries,      '#title' => t('Tv series'),
236      '#description' => t('Is this a tv series?'),      '#return_value' => 1,
237    );      '#default_value' => $node->tvseries,
238        '#description' => t('Is this a tv series?'),
239    $form['cover'] = array(    );
240      '#type' => 'textfield',  
241      '#title' => t('Cover picture'),    $form['cover'] = array(
242      '#default_value' => $node->cover,      '#type' => 'textfield',
243      '#size' => 60,      '#title' => t('Cover picture'),
244      '#maxlength' => 255,      '#default_value' => $node->cover,
245      '#description' => t('URL of movie cover image.'),      '#size' => 60,
246    );      '#maxlength' => 255,
247        '#description' => t('URL of movie cover image.'),
248    $form['genre'] = array(    );
249      '#type' => 'textfield',  
250      '#title' => t('Genre'),    $form['genre'] = array(
251      '#default_value' => $node->genre,      '#type' => 'textfield',
252      '#size' => 60,      '#title' => t('Genre'),
253      '#maxlength' => 255,      '#default_value' => $node->genre,
254      '#description' => t('Genre of the movie.'),      '#size' => 60,
255    );      '#maxlength' => 255,
256        '#description' => t('Genre of the movie.'),
257    $form['director'] = array(    );
258      '#type' => 'textfield',  
259      '#title' => t('Director'),    $form['director'] = array(
260      '#default_value' => $node->director,      '#type' => 'textfield',
261      '#size' => 60,      '#title' => t('Director'),
262      '#maxlength' => 255,      '#default_value' => $node->director,
263      '#description' => t('Director(s) of the movie.'),      '#size' => 60,
264    );      '#maxlength' => 255,
265        '#description' => t('Director(s) of the movie.'),
266    $form['writer'] = array(    );
267      '#type' => 'textfield',  
268      '#title' => t('Writer'),    $form['writer'] = array(
269      '#default_value' => $node->writer,      '#type' => 'textfield',
270      '#size' => 60,      '#title' => t('Writer'),
271      '#maxlength' => 255,      '#default_value' => $node->writer,
272      '#description' => t('Writing credits.'),      '#size' => 60,
273    );      '#maxlength' => 255,
274        '#description' => t('Writing credits.'),
275    $form[] = array(    );
276      '#type' => 'item',  
277      '#title' => t('Actor(s)'),    $form[] = array(
278      '#default_value' => '',      '#type' => 'item',
279    );      '#title' => t('Actor(s)'),
280        '#default_value' => '',
281    for ($i = 0; $i < $node->numactors; $i++) {    );
282      $form["actor-$i"] = array(  
283        '#type' => 'textfield',    for ($i = 0; $i < $node->numactors; $i++) {
284        '#title' => '',      $form["actor-$i"] = array(
285        '#default_value' => $node->actors[$i],        '#type' => 'textfield',
286        '#size' => 60,        '#title' => '',
287        '#maxlength' => 255,        '#default_value' => $node->actors[$i],
288        '#description' => '',        '#size' => 60,
289      );        '#maxlength' => 255,
290    }        '#description' => '',
291        );
292    $form['moviereview_more_actors'] = array(    }
293      '#type' => 'checkbox',  
294      '#title' => t('add more actors'),    $form['moviereview_more_actors'] = array(
295      '#return_value' => 1,      '#type' => 'checkbox',
296      '#default_value' => 0,      '#title' => t('add more actors'),
297      '#description' => t('You can create space to list more actors by checking this box and clicking '). '<b>'. t('Preview'). '</b>.',      '#return_value' => 1,
298    );      '#default_value' => 0,
299        '#description' => t('You can create space to list more actors by checking this box and clicking '). '<b>'. t('Preview'). '</b>.',
300    $form['runtime'] = array(    );
301      '#type' => 'textfield',  
302      '#title' => t('Runtime'),    $form['runtime'] = array(
303      '#default_value' => $node->runtime,      '#type' => 'textfield',
304      '#size' => 60,      '#title' => t('Runtime'),
305      '#maxlength' => 255,      '#default_value' => $node->runtime,
306      '#description' => t('The movie run time.'),      '#size' => 60,
307    );      '#maxlength' => 255,
308        '#description' => t('The movie run time.'),
309    $form['country'] = array(    );
310      '#type' => 'textfield',  
311      '#title' => t('Country'),    $form['country'] = array(
312      '#default_value' => $node->country,      '#type' => 'textfield',
313      '#size' => 60,      '#title' => t('Country'),
314      '#maxlength' => 255,      '#default_value' => $node->country,
315      '#description' => t('Country of movie production.'),      '#size' => 60,
316    );      '#maxlength' => 255,
317        '#description' => t('Country of movie production.'),
318    $form['language'] = array(    );
319      '#type' => 'textfield',  
320      '#title' => t('Language'),    $form['language'] = array(
321      '#default_value' => $node->language,      '#type' => 'textfield',
322      '#size' => 60,      '#title' => t('Language'),
323      '#maxlength' => 255,      '#default_value' => $node->language,
324      '#description' => t('Language of the movie.'),      '#size' => 60,
325    );      '#maxlength' => 255,
326        '#description' => t('Language of the movie.'),
327    $form['imdb'] = array(    );
328      '#type' => 'textfield',  
329      '#title' => t('Imdb'),    $form['imdb'] = array(
330      '#default_value' => $node->imdb,      '#type' => 'textfield',
331      '#size' => 60,      '#title' => t('Imdb'),
332      '#maxlength' => 255,      '#default_value' => $node->imdb,
333      '#description' => t('Imdb id of the movie'),      '#size' => 60,
334    );      '#maxlength' => 255,
335        '#description' => t('Imdb id of the movie'),
336    $form['media'] = array(    );
337      '#type' => 'textfield',  
338      '#title' => t('Media'),    $form['media'] = array(
339      '#default_value' => $node->media,      '#type' => 'textfield',
340      '#size' => 60,      '#title' => t('Media'),
341      '#maxlength' => 255,      '#default_value' => $node->media,
342      '#description' => t('Media in which the movie is available'),      '#size' => 60,
343    );      '#maxlength' => 255,
344        '#description' => t('Media in which the movie is available'),
345    $form['price'] = array(    );
346      '#type' => 'textfield',  
347      '#title' => t('Price'),    $form['price'] = array(
348      '#default_value' => $node->price,      '#type' => 'textfield',
349      '#size' => 60,      '#title' => t('Price'),
350      '#maxlength' => 255,      '#default_value' => $node->price,
351      '#description' => t('The cost of the movie being reviewed.'),      '#size' => 60,
352    );      '#maxlength' => 255,
353        '#description' => t('The cost of the movie being reviewed.'),
354    $form['rating'] = array(    );
355      '#type' => 'select',  
356      '#title' => t('Rating'),    $form['rating'] = array(
357      '#default_value' => $node->rating,      '#type' => 'select',
358      '#options' => (array("<" . t('none') . ">") + drupal_map_assoc(range(1, 10))),      '#title' => t('Rating'),
359      '#description' => t('Score of the movie on a 1 to 10 scale.'),      '#default_value' => $node->rating,
360    );      '#options' => (array("<" . t('none') . ">") + drupal_map_assoc(range(1, 10))),
361        '#description' => t('Score of the movie on a 1 to 10 scale.'),
362    $form['body'] = array(    );
363      '#type' => 'textarea',  
364      '#title' => t('Synopsis'),    $form['body'] = array(
365      '#default_value' => $node->body,      '#type' => 'textarea',
366      '#cols' => 60,      '#title' => t('Synopsis'),
367      '#rows' => 18,      '#default_value' => $node->body,
368      '#description' => t('A synopsis of the movie being reviewed.'),      '#cols' => 60,
369    );      '#rows' => 18,
370        '#description' => t('A synopsis of the movie being reviewed.'),
371    // Only display this field if longer input format was choosen    );
372    if (variable_get('moviereview_detail', 0) == 0) {  
373      $form['location'] = array(    // Only display this field if longer input format was choosen
374        '#type' => 'textarea',    if (variable_get('moviereview_detail', 0) == 0) {
375        '#title' => t('Location'),      $form['location'] = array(
376        '#default_value' => $node->location,        '#type' => 'textarea',
377        '#cols' => 60,        '#title' => t('Location'),
378        '#rows' => 18,        '#default_value' => $node->location,
379        '#description' => t('Filming location.'),        '#cols' => 60,
380      );        '#rows' => 18,
381    }        '#description' => t('Filming location.'),
382        );
383    $form['review'] = array(    }
384      '#type' => 'textarea',  
385      '#title' => t('Review'),    $form['review'] = array(
386      '#default_value' => $node->review,      '#type' => 'textarea',
387      '#cols' => 60,      '#title' => t('Review'),
388      '#rows' => 18,      '#default_value' => $node->review,
389      '#description' => t('This is the actual movie review.'),      '#cols' => 60,
390    );      '#rows' => 18,
391        '#description' => t('This is the actual movie review.'),
392  //  $form[] = array(    );
393  //    '#type' => 'item',  
394  //    '#title' => t('Offsite links'),  //  $form[] = array(
395  //    '#default_value' => '',  //    '#type' => 'item',
396  //  );  //    '#title' => t('Offsite links'),
397    //    '#default_value' => '',
398    // TODO:  Replace table formatting with css  //  );
399  //  $output .= '<div id="mr_links">'."<table>\n";  
400  //  for ($i = 0; $i < $node->numlinks; $i++) {    // TODO:  Replace table formatting with css
401  //    $output .= "  <tr><td>\n";  //  $output .= '<div id="mr_links">'."<table>\n";
402  //    $output .= form_textfield(t('URL'), "movielinks][$i", $node->movielinks[$i], 45, 255, '');  //  for ($i = 0; $i < $node->numlinks; $i++) {
403  //    $output .= "  </td><td>\n";  //    $output .= "  <tr><td>\n";
404  //    $output .= form_textfield(t('Description'), "linkdescriptions][$i", $node->linkdescriptions[$i], 45, 255, '');  //    $output .= form_textfield(t('URL'), "movielinks][$i", $node->movielinks[$i], 45, 255, '');
405  //    $output .= "  </td></tr>\n";  //    $output .= "  </td><td>\n";
406  //  }  //    $output .= form_textfield(t('Description'), "linkdescriptions][$i", $node->linkdescriptions[$i], 45, 255, '');
407  //  $output .= "</table></div>\n";  //    $output .= "  </td></tr>\n";
408  //  $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>.');  //  }
409  //  $output .= "</div>";  //  $output .= "</table></div>\n";
410  //  $output .= filter_form('format', $node->format);  //  $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>.');
411    //  $output .= "</div>";
412  //  return $output;  //  $output .= filter_form('format', $node->format);
413  //}  
414    //  return $output;
415    $form['offsite_links'] = array(  //}
416      '#type' => 'fieldset',  
417      '#title' => t('Offsite links'),    $form['offsite_links'] = array(
418      '#collapsible' => TRUE,      '#type' => 'fieldset',
419      '#collapsed' => TRUE,      '#title' => t('Offsite links'),
420    );      '#collapsible' => TRUE,
421        '#collapsed' => TRUE,
422    $form['offsite_links']['movielinks_begin'] = array(    );
423        '#type' => 'markup',  
424        '#value' => '<table>',    $form['offsite_links']['movielinks_begin'] = array(
425    );        '#type' => 'markup',
426    for ($i = 0; $i < $node->numlinks; $i++) {        '#value' => '<table>',
427      $form['offsite_links']["movielink-$i"] = array(    );
428        '#type' => 'textfield',    for ($i = 0; $i < $node->numlinks; $i++) {
429        '#title' => 'URL',      $form['offsite_links']["movielink-$i"] = array(
430        '#default_value' => $node->movielinks[$i],        '#type' => 'textfield',
431        '#size' => 45,        '#title' => 'URL',
432        '#maxlength' => 255,        '#default_value' => $node->movielinks[$i],
433        '#description' => '',        '#size' => 45,
434        '#prefix' => '<tr><td>',        '#maxlength' => 255,
435        '#suffix' => '</td>',        '#description' => '',
436      );        '#prefix' => '<tr><td>',
437      $form['offsite_links']["linkdescription-$i"] = array(        '#suffix' => '</td>',
438        '#type' => 'textfield',      );
439        '#title' => 'Description',      $form['offsite_links']["linkdescription-$i"] = array(
440        '#default_value' => $node->linkdescriptions[$i],        '#type' => 'textfield',
441        '#size' => 45,        '#title' => 'Description',
442        '#maxlength' => 255,        '#default_value' => $node->linkdescriptions[$i],
443        '#description' => '',        '#size' => 45,
444        '#prefix' => '<td>',        '#maxlength' => 255,
445        '#suffix' => '</td></tr>',        '#description' => '',
446      );        '#prefix' => '<td>',
447    }        '#suffix' => '</td></tr>',
448    $form['offsite_links']['movielinks_end'] = array(      );
449        '#type' => 'markup',    }
450        '#value' => '</table>',    $form['offsite_links']['movielinks_end'] = array(
451    );        '#type' => 'markup',
452          '#value' => '</table>',
453    $form['offsite_links']['moviereview_more_links'] = array(    );
454      '#type' => 'checkbox',  
455      '#title' => t('add more links'),    $form['offsite_links']['moviereview_more_links'] = array(
456      '#value' => 0,      '#type' => 'checkbox',
457      '#description' => t('If you need to add more links, check this box and click '). '<strong>'. t('Preview'). '</strong>.',      '#title' => t('add more links'),
458    );      '#value' => 0,
459        '#description' => t('If you need to add more links, check this box and click '). '<strong>'. t('Preview'). '</strong>.',
460    $form['format'] = filter_form($node->format);    );
461    
462    return $form;    $form['format'] = filter_form($node->format);
463    
464  }    return $form;
465    
466    }
467  function moviereview_menu($may_cache) {  
468    $items = array();  
469    function moviereview_menu($may_cache) {
470    if ($may_cache) {    $items = array();
471      $items[] = array('path' => 'node/add/moviereview',  
472                       'title' => t('movie review'),    if ($may_cache) {
473                       'access' => user_access('create moviereviews'),      $items[] = array('path' => 'node/add/moviereview',
474                       'callback' => 'node_page');                       'title' => t('movie review'),
475      $items[] = array('path' => 'moviereview',                       'access' => user_access('create moviereviews'),
476                       'title' => t('movie reviews'),                       'callback' => 'node_page');
477                       'access' => user_access('access content'),      $items[] = array('path' => 'moviereview',
478                       'callback' => 'moviereview_page',                       'title' => t('movie reviews'),
479                       'type' => MENU_SUGGESTED_ITEM);                       'access' => user_access('access content'),
480    }                       'callback' => 'moviereview_page',
481    else {                       'type' => MENU_SUGGESTED_ITEM);
482      if ($css = variable_get('moviereview_css', 'modules/moviereview/moviereview.css')) {    }
483        drupal_set_html_head("\n<style type=\"text/css\">@import \"$css\";</style>\n");    else {
484      }      if ($css = variable_get('moviereview_css', drupal_get_path('module', 'moviereview') .'/moviereview.css')) {
485    }            //add stylesheet
486    return $items;            drupal_add_link(array(
487  }                          'href'=>$css,
488                            'rel'=>'stylesheet',
489  function moviereview_settings() {                          'type'=>'text/css')
490    if (!file_check_location(variable_get('moviereview_css', 'modules/moviereview/moviereview.css'))) {                          );
491      $error['moviereview_css'] = theme('error', t('File does not exist, or is not readable.'));      }
492    }    }
493      return $items;
494    $form['moviereview_settings'] = array(  }
495      '#type' => 'fieldset',  
496      '#title' => t('Moviereview settings'),  function moviereview_settings() {
497    );    if (!file_check_location(variable_get('moviereview_css', base_path() . drupal_get_path('module', 'moviereview') .'/moviereview.css'))) {
498        $error['moviereview_css'] = theme('error', t('File does not exist, or is not readable.'));
499    $form['moviereview_settings']['stylesheet'] = array(    }
500      '#type' => 'textfield',  
501      '#title' => t('Style sheet'),    $form['moviereview_settings'] = array(
502      '#default_value' => variable_get('moviereview_css', 'modules/moviereview/moviereview.css'),      '#type' => 'fieldset',
503      '#size' => 70,      '#title' => t('Moviereview settings'),
504      '#maxlength' => 255,    );
505      '#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']),  
506    );    $form['moviereview_settings']['moviereview_css'] = array(
507        '#type' => 'textfield',
508    $form['moviereview_settings']['moviereview_detail'] = array(      '#title' => t('Style sheet'),
509      '#type' => 'radios',      '#default_value' => variable_get('moviereview_css', base_path() . drupal_get_path('module', 'moviereview') .'/moviereview.css'),
510      '#title' => t('Details to collect'),      '#size' => 70,
511      '#default_value' => variable_get('moviereview_detail', 0),      '#maxlength' => 255,
512      '#options' => array(t('Synopsis, Location and Review'), t('Synopsis and Review only')),      '#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']),
513      '#description' => t('Details you would like to collect about the movies as freeform text.'),    );
514    );  
515      $form['moviereview_settings']['moviereview_detail'] = array(
516    $form['moviereview_settings']['moviereview_help'] = array(      '#type' => 'radios',
517      '#type' => 'textarea',      '#title' => t('Details to collect'),
518      '#title' => t('Explanation or submission guidelines'),      '#default_value' => variable_get('moviereview_detail', 0),
519      '#default_value' => variable_get('moviereview_help', ''),      '#options' => array(t('Synopsis, Location and Review'), t('Synopsis and Review only')),
520      '#cols' => 55,      '#description' => t('Details you would like to collect about the movies as freeform text.'),
521      '#rows' => 4,    );
522      '#description' => t('This text will be displayed at the top of the movie review submission form.  Useful for helping or instructing your users.'),  
523    );    $form['moviereview_settings']['moviereview_help'] = array(
524        '#type' => 'textarea',
525    $form['minimum_moviereview_size'] = array(      '#title' => t('Explanation or submission guidelines'),
526      '#type' => 'select',      '#default_value' => variable_get('moviereview_help', ''),
527      '#title' => t('Minimum number of words'),      '#cols' => 55,
528      '#default_value' => variable_get('minimum_moviereview_size', 0),      '#rows' => 4,
529      '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200, 500, 1000)),      '#description' => t('This text will be displayed at the top of the movie review submission form.  Useful for helping or instructing your users.'),
530      '#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.'),    );
531    );  
532      $form['minimum_moviereview_size'] = array(
533    return $form;      '#type' => 'select',
534  }      '#title' => t('Minimum number of words'),
535        '#default_value' => variable_get('minimum_moviereview_size', 0),
536  function moviereview_page() {      '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200, 500, 1000)),
537    drupal_set_title(t('Movie reviews'));      '#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.'),
538    print theme('page', moviereview_overview());    );
539  }  
540      return $form;
541  function moviereview_overview() {  }
542    //if (module_exist('search')) {  
543    //  $output .= search_type('moviereview', url('search'), NULL, 1);  function moviereview_page() {
544    //}    drupal_set_title(t('Movie reviews'));
545    $output .= '<div class="moviereview-list">'.theme_moviereview_list().'</div>';    print theme('page', moviereview_overview());
546    return $output;  }
547  }  
548    function moviereview_overview() {
549  function theme_moviereview_list() {    //if (module_exist('search')) {
550      //  $output .= search_type('moviereview', url('search'), NULL, 1);
551    $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%'));    //}
552      $output .= '<div class="moviereview-list">'.theme_moviereview_list().'</div>';
553    $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');    return $output;
554    $sql .= tablesort_sql($header);  }
555    $result = pager_query($sql, 20);  
556    function theme_moviereview_list() {
557    while ($node = db_fetch_object($result)) {  
558      $output = '';    $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%'));
559      $actors = '';  
560      $count = 0;    $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');
561      $a = db_query('SELECT actor, weight FROM {moviereview_actors} WHERE nid = %d ORDER BY weight', $node->nid);    $sql .= tablesort_sql($header);
562      $result = pager_query($sql, 20);
563      while ($actor = db_fetch_object($a)) {  
564        $count++;    while ($node = db_fetch_object($result)) {
565        if($actors)      $output = '';
566          $actors .= ', '.$actor->actor;      $actors = '';
567        else      $count = 0;
568          $actors = $actor->actor;      $a = db_query('SELECT actor, weight FROM {moviereview_actors} WHERE nid = %d ORDER BY weight', $node->nid);
569      }  
570        while ($actor = db_fetch_object($a)) {
571      if ($title) {        $count++;
572        $output = t('<b>Title:</b> %title', array('%title' => $node->title)) .'<br />';        if($actors)
573      }          $actors .= ', '.$actor->actor;
574      if ($node->movietitle) {        else
575        $output .= t('<b>Movie Title:</b> %movietitle', array('%movietitle' => $node->movietitle)) .'<br />';          $actors = $actor->actor;
576      }      }
577      if ($actors) {  
578        $output .= t('<b>%tag:</b> %actors', array('%tag' => format_plural($count, 'Cast', 'Cast'), '%actors' => $actors)) .'<br />';      if ($title) {
579      }        $output = t('<b>Title:</b> %title', array('%title' => $node->title)) .'<br />';
580      if ($node->director) {      }
581        $output .= t('<b>Directed by:</b> %director', array('%director' => $node->director)) .'<br />';      if ($node->movietitle) {
582      }        $output .= t('<b>Movie Title:</b> %movietitle', array('%movietitle' => $node->movietitle)) .'<br />';
583      if ($node->releaseyear) {      }
584        $output .= t('<b>Year:</b> %releaseyear', array('%releaseyear' => $node->releaseyear)) .'<br />';      if ($actors) {
585      }        $output .= t('<b>%tag:</b> %actors', array('%tag' => format_plural($count, 'Cast', 'Cast'), '%actors' => $actors)) .'<br />';
586      if ($node->runtime) {      }
587        $output .= t('<b>Runtime:</b> %runtime', array('%runtime' => $node->runtime)) .'<br />';      if ($node->director) {
588      }        $output .= t('<b>Directed by:</b> %director', array('%director' => $node->director)) .'<br />';
589      //if ($node->imdb) {      }
590      //  $output .= t('<b>Imdb:</b> %imdb', array('%imdb' => $node->imdb)) .'<br />';      if ($node->releaseyear) {
591      //}        $output .= t('<b>Year:</b> %releaseyear', array('%releaseyear' => $node->releaseyear)) .'<br />';
592      if ($node->rating) {      }
593        $output .= t('<b>Rating:</b> %rating', array('%rating' => $node->rating)) .'<br />';      if ($node->runtime) {
594      }        $output .= t('<b>Runtime:</b> %runtime', array('%runtime' => $node->runtime)) .'<br />';
595      if ($node->price) {      }
596        $output .= t('<b>Price:</b> %price', array('%price' => $node->price)) .'<br />';      //if ($node->imdb) {
597      }      //  $output .= t('<b>Imdb:</b> %imdb', array('%imdb' => $node->imdb)) .'<br />';
598      if ($node->cover) {      //}
599        $cover = "<img src='$node->cover' border='0'>";      if ($node->rating) {
600      }        $output .= t('<b>Rating:</b> %rating', array('%rating' => $node->rating)) .'<br />';
601      else {      }
602        $cover = '&nbsp;';      if ($node->price) {
603      }        $output .= t('<b>Price:</b> %price', array('%price' => $node->price)) .'<br />';
604        }
605      $rows[] = array($cover, array('data' => l($node->title, "node/$node->nid", array('title' => t('View this posting.'))) ."<br /><br />$output", 'colspan' => '3', 'valign' => 'top'));      if ($node->cover) {
606    }        $cover = "<img src='$node->cover' border='0'>";
607        }
608    if (!$rows) {      else {
609      $rows[] = array(array('data' => t('No movie reviews available.'), 'colspan' => '4'));        $cover = '&nbsp;';
610    }      }
611    
612    $extra = array();      $rows[] = array($cover, array('data' => l($node->title, "node/$node->nid", array('title' => t('View this posting.'))) ."<br /><br />$output", 'colspan' => '3', 'valign' => 'top'));
613    if (array_key_exists('sort', $_GET))    }
614      $extra['sort'] = $_GET['sort'];  
615    if (array_key_exists('order', $_GET))    if (!$rows) {
616      $extra['order'] = $_GET['order'];      $rows[] = array(array('data' => t('No movie reviews available.'), 'colspan' => '4'));
617    $pager = theme('pager', NULL, 20, 0, $extra);    }
618    
619    if (!empty($pager)) {    $extra = array();
620      $rows[] = array(array('data' => $pager, 'colspan' => '4'));    if (array_key_exists('sort', $_GET))
621    }      $extra['sort'] = $_GET['sort'];
622      if (array_key_exists('order', $_GET))
623    return theme('table', $header, $rows);      $extra['order'] = $_GET['order'];
624  }    $pager = theme('pager', NULL, 20, 0, $extra);
625    
626  function moviereview_view(&$node, $teaser = FALSE, $page = FALSE) {    if (!empty($pager)) {
627    global $theme;      $rows[] = array(array('data' => $pager, 'colspan' => '4'));
628      }
629    if ($page) {  
630      $breadcrumb = array();    return theme('table', $header, $rows);
631      $breadcrumb[] = array('path' => 'moviereview', title => t('movie review'));  }
632      $breadcrumb[] = array('path' => $_GET['q']);  
633      menu_set_location($breadcrumb);  function moviereview_view(&$node, $teaser = FALSE, $page = FALSE) {
634    }    global $theme;
635    
636    // Allows themes to override how the review should look like,    if ($page) {
637    // but we cannot depend on the theme() functions, since we      $breadcrumb = array();
638    // need to pass the node by reference!      $breadcrumb[] = array('path' => 'moviereview', title => t('movie review'));
639    $themefunction = "{$theme}_moviereview_content";      $breadcrumb[] = array('path' => $_GET['q']);
640    if (!function_exists($themefunction)) {      menu_set_location($breadcrumb);
641      $themefunction = "theme_moviereview_content";    }
642    }  
643    $themefunction($node, $main, $page);    // Allows themes to override how the review should look like,
644  }    // but we cannot depend on the theme() functions, since we
645      // need to pass the node by reference!
646  function theme_moviereview_content(&$node, $main = 0, $page = 0) {    $themefunction = "{$theme}_moviereview_content";
647      if (!function_exists($themefunction)) {
648    $output = "<div class=\"moviereview\">\n";      $themefunction = "theme_moviereview_content";
649    $output .= "<table width=\"100%\">";    }
650    $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";    $themefunction($node, $main, $page);
651    $output .= "<tr><td width=\"15%\" class=\"mr_cover\" align=\"left\" valign=\"top\">";  }
652    if($node->cover) {  
653      $output .= "    <div class=\"cover\"><img src=\"$node->cover\"></div>\n";  function theme_moviereview_content(&$node, $main = 0, $page = 0) {
654    }  
655    $output .= "</td>";    $output = "<div class=\"moviereview\">\n";
656    $output .= "<td width=\"85%\" class=\"mr_detail\">";    $output .= "<table width=\"100%\">";
657    if($node->movietitle) {    $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
658      $output .=  "    <div class=\"label2\">". t("Movie title") .": </div><div class=\"content2\">". $node->movietitle . "</div>";    $output .= "<tr><td width=\"15%\" class=\"mr_cover\" align=\"left\" valign=\"top\">";
659    }    if($node->cover) {
660    if($node->actors[0]) {      $output .= "    <div class=\"cover\"><img src=\"$node->cover\"></div>\n";
661      foreach($node->actors as $actor) {    }
662        if($actors)    $output .= "</td>";
663          $actors .= ", $actor";    $output .= "<td width=\"85%\" class=\"mr_detail\">";
664        else    if($node->movietitle) {
665          $actors = "$actor";      $output .=  "    <div class=\"label2\">". t("Movie title") .": </div><div class=\"content2\">". $node->movietitle . "</div>";
666      }    }
667      $output .= "    <div class=\"label2\">". t("Starring") .": </div><div class=\"content2\">". $actors . "</div>";    if($node->actors[0]) {
668    }      foreach($node->actors as $actor) {
669          if($actors)
670    if($node->director) {          $actors .= ", $actor";
671      $output .= "    <div class=\"label2\">". t('Directed by') .": </div><div class=\"content2\">". $node->director ."</div>\n";        else
672    }          $actors = "$actor";
673    if($node->writer) {      }
674      $output .= "    <div class=\"label2\">". t('Written by') .": </div><div class=\"content2\">". $node->writer ."</div>\n";      $output .= "    <div class=\"label2\">". t("Starring") .": </div><div class=\"content2\">". $actors . "</div>";
675    }    }
676    if($node->genre) {  
677      $output .= "    <div class=\"label2\">". t('Genre') .": </div><div class=\"content2\">". $node->genre ."</div>\n";    if($node->director) {
678    }      $output .= "    <div class=\"label2\">". t('Directed by') .": </div><div class=\"content2\">". $node->director ."</div>\n";
679      }
680    if($node->tvseries) {    if($node->writer) {
681      if ($node->tvseries = 1){      $output .= "    <div class=\"label2\">". t('Written by') .": </div><div class=\"content2\">". $node->writer ."</div>\n";
682        $output .= "    <div class=\"label2\">". t('Tv series') .": </div><div class=\"content2\">". t('Yes') ."</div>\n";    }
683      }    if($node->genre) {
684    }      $output .= "    <div class=\"label2\">". t('Genre') .": </div><div class=\"content2\">". $node->genre ."</div>\n";
685      }
686    if($node->releaseyear) {  
687      $output .= "    <div class=\"label2\">". t('Year') .": </div><div class=\"content2\">". $node->releaseyear ."</div>\n";    if($node->tvseries) {
688    }      if ($node->tvseries = 1){
689    if($node->country) {        $output .= "    <div class=\"label2\">". t('Tv series') .": </div><div class=\"content2\">". t('Yes') ."</div>\n";
690      $output .= "    <div class=\"label2\">". t('Country') .": </div><div class=\"content2\">". $node->country ."</div>\n";      }
691    }    }
692    if($node->language) {  
693      $output .= "    <div class=\"label2\">". t('Language') .": </div><div class=\"content2\">". $node->language ."</div>\n";    if($node->releaseyear) {
694    }      $output .= "    <div class=\"label2\">". t('Year') .": </div><div class=\"content2\">". $node->releaseyear ."</div>\n";
695    if($node->runtime) {    }
696      $output .= "    <div class=\"label2\">". t('Runtime') .": </div><div class=\"content2\">". $node->runtime ."</div>\n";    if($node->country) {
697    }      $output .= "    <div class=\"label2\">". t('Country') .": </div><div class=\"content2\">". $node->country ."</div>\n";
698    if($node->media) {    }
699      $output .= "    <div class=\"label2\">". t('Media') .": </div><div class=\"content2\">". $node->media ."</div>\n";    if($node->language) {
700    }      $output .= "    <div class=\"label2\">". t('Language') .": </div><div class=\"content2\">". $node->language ."</div>\n";
701    if($node->imdb) {    }
702      $output .= "    <div class=\"label2\">". t('Imdb') .": </div><div class=\"content2\">". "<a href=\"http://www.imdb.com/title/". $node->imdb ."/\" target=\"_blank\">" . $node->imdb . "</a></div>\n";    if($node->runtime) {
703    }      $output .= "    <div class=\"label2\">". t('Runtime') .": </div><div class=\"content2\">". $node->runtime ."</div>\n";
704    if($node->rating) {    }
705      $output .= "    <div class=\"label2\">". t('Rating') .": </div><div class=\"content2\">". $node->rating ."</div>\n";    if($node->media) {
706    }      $output .= "    <div class=\"label2\">". t('Media') .": </div><div class=\"content2\">". $node->media ."</div>\n";
707    if($node->price) {    }
708      $output .= "    <div class=\"label2\">". t('Price') .": </div><div class=\"content2\">". $node->price . "</div>\n";    if($node->imdb) {
709    }      $output .= "    <div class=\"label2\">". t('Imdb') .": </div><div class=\"content2\">". "<a href=\"http://www.imdb.com/title/". $node->imdb ."/\" target=\"_blank\">" . $node->imdb . "</a></div>\n";
710      }
711      if($node->rating) {
712    $output .= "</td>";      $output .= "    <div class=\"label2\">". t('Rating') .": </div><div class=\"content2\">". $node->rating ."</div>\n";
713    $output .= "</tr>";    }
714    $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";    if($node->price) {
715    $output .= "</table>";      $output .= "    <div class=\"label2\">". t('Price') .": </div><div class=\"content2\">". $node->price . "</div>\n";
716      }
717    
718    $output .= " \n"; // end of header  
719    if($node->body) {    $output .= "</td>";
720      $output .= "  <div class=\"synopsis\">\n";    $output .= "</tr>";
721      $output .= "    <span class=\"label4\">". t('Synopsis') ."</span><br />\n";    $output .= "<tr><td colspan=\"2\">&nbsp;</td></tr>";
722      $output .= "    <span class=\"content2\">". check_markup($node->body, $node->format) ."</span>\n";    $output .= "</table>";
723      $output .= "  </div><br />\n";  
724    }  
725    if($node->location) {    $output .= " \n"; // end of header
726      $output .= "  <div class=\"location\">\n";    if($node->body) {
727      $output .= "    <span class=\"label4\">". t('Location') ."</span><br />\n";      $output .= "  <div class=\"synopsis\">\n";
728      $output .= "    <span class=\"content2\">". check_markup($node->location, $node->format) ."</span>\n";      $output .= "    <span class=\"label4\">". t('Synopsis') ."</span><br />\n";
729      $output .= "  </div><br />\n";      $output .= "    <span class=\"content2\">". check_markup($node->body, $node->format) ."</span>\n";
730    }      $output .= "  </div><br />\n";
731    if($node->review) {    }
732      $output .= "  <div class=\"review\">\n";    if($node->location) {
733      $output .= "    <span class=\"label4\">". t('Review') ."</span><br />\n";      $output .= "  <div class=\"location\">\n";
734      $output .= "    <span class=\"content2\">". check_markup($node->review, $node->format) ."</span>\n";      $output .= "    <span class=\"label4\">". t('Location') ."</span><br />\n";
735      $output .= "  </div><br />\n";      $output .= "    <span class=\"content2\">". check_markup($node->location, $node->format) ."</span>\n";
736    }      $output .= "  </div><br />\n";
737    if($node->movielinks[0]) {    }
738      $output .= "  <div class=\"movielinks\">\n";    if($node->review) {
739      $output .= "    <span class=\"label4\">". t('Related links') .":</span><br />\n";      $output .= "  <div class=\"review\">\n";
740      $numlinks = count($node->movielinks);      $output .= "    <span class=\"label4\">". t('Review') ."</span><br />\n";
741      for ($i = 0; $i < $numlinks; $i++) {      $output .= "    <span class=\"content2\">". check_markup($node->review, $node->format) ."</span>\n";
742        $movielink = $node->movielinks[$i];      $output .= "  </div><br />\n";
743        $linkdescription = $node->linkdescriptions[$i] ? $node->linkdescriptions[$i] : $node->movielinks[$i];    }
744        if(ereg('^http://|^https://|ftp://',"$movielink")) {    if($node->movielinks[0]) {
745          // off site link      $output .= "  <div class=\"movielinks\">\n";
746          $movielink = "<a href=\"$movielink\">". check_markup($linkdescription, $node->format) .'</a>';      $output .= "    <span class=\"label4\">". t('Related links') .":</span><br />\n";
747        }      $numlinks = count($node->movielinks);
748        elseif($movielink) {      for ($i = 0; $i < $numlinks; $i++) {
749          // on site link        $movielink = $node->movielinks[$i];
750          $movielink = l("$linkdescription", "$movielink");        $linkdescription = $node->linkdescriptions[$i] ? $node->linkdescriptions[$i] : $node->movielinks[$i];
751        }        if(ereg('^http://|^https://|ftp://',"$movielink")) {
752        $output .= "    <span class=\"content2\">". check_markup($movielink, $node->format) ."</span>\n";          // off site link
753      }          $movielink = "<a href=\"$movielink\">". check_markup($linkdescription, $node->format) .'</a>';
754      $output .= "  </div>\n";        }
755    }        elseif($movielink) {
756    $output .= "</div>\n"; // end of moviereview          // on site link
757            $movielink = l("$linkdescription", "$movielink");
758    $node->body = $output;        }
759          $output .= "    <span class=\"content2\">". check_markup($movielink, $node->format) ."</span>\n";
760        }
761        $output .= "  </div>\n";
762      }
763      $output .= "</div>"; // end of moviereview
764    
765      $node->body = $output;
766  }  }

Legend:
Removed from v.1.6.2.5  
changed lines
  Added in v.1.6.2.6

  ViewVC Help
Powered by ViewVC 1.1.2