| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Validate whether an argument is a project node. 5 * 6 * This supports either numeric arguments (nid) or strings (project uri) and 7 * converts either one into the project nid. This validator also sets the 8 * argument's title to the full title of the project node. 9 */ 10 class project_plugin_argument_validate_project_nid extends views_plugin_argument_validate { 11 function validate_argument($argument) { 12 if (is_numeric($argument)) { 13 $result = db_fetch_object(db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.nid = %d AND n.type = '%s'"), $argument, 'project_project')); 14 } 15 else { 16 $result = db_fetch_object(db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n INNER JOIN {project_projects} p ON n.nid = p.nid WHERE p.uri ='%s'"), $argument)); 17 } 18 if (!$result) { 19 return FALSE; 20 } 21 $this->argument->argument = $result->nid; 22 $this->argument->validated_title = check_plain($result->title); 23 return TRUE; 24 } 25 } 26
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |