Example #1
0
 /**
  * Determine whether a given value is valid for a foreign key (i.e. is the
  * title of a foreign row).
  * 
  * @param Webdb_DBMS_Column $column
  * @param integer $col_num
  * @param integer $row_num
  * @param string $value
  * @return FALSE if the value is valid
  * @return array error array if the value is not valid
  */
 protected function validate_foreign_key($column, $col_num, $row_num, $value)
 {
     $foreign_table = $column->get_referenced_table();
     if (!$this->get_fk_rows($foreign_table, $value)) {
         $link = '<a href="' . $foreign_table->get_url() . '" title="Opens in a new tab or window" target="_blank" >' . $foreign_table->get_title() . '</a>';
         return "Value <code>{$value}</code> not found in {$link}";
     }
     return false;
 }
Example #2
0
 /**
  * Determine whether a given value is valid for a foreign key (i.e. is the
  * title of a foreign row).
  * 
  * @param Webdb_DBMS_Column $column
  * @param integer $col_num
  * @param integer $row_num
  * @param string $value
  * @return FALSE if the value is valid
  * @return array error array if the value is not valid
  */
 public function validate_foreign_key($column, $col_num, $row_num, $value)
 {
     $foreign_table = $column->get_referenced_table();
     if (!$this->get_fk_rows($foreign_table, $value)->valid()) {
         $route_params = array('action' => 'index', 'dbname' => $foreign_table->get_database()->get_name(), 'tablename' => $foreign_table->get_name());
         $uri = Route::url('default', $route_params, TRUE);
         $a_params = array('target' => '_blank', 'title' => 'Opens in a new tab or window');
         $link = HTML::anchor($uri, Webdb_Text::titlecase($foreign_table->get_name()), $a_params);
         return 'Value (' . $value . ') not found in ' . $link;
     }
     return FALSE;
 }