Esempio n. 1
0
 function buildRelatedSection($record, $relationship)
 {
     import('Dataface/RelatedList.php');
     $relatedList = new Dataface_RelatedList($record, $relationship);
     $relatedList->noLinks = true;
     $relatedList->hideActions = true;
     $content = $relatedList->toHtml();
     $rel = $record->table()->getRelationship($relationship);
     return array('class' => 'main', 'content' => $content, 'label' => $rel->getLabel(), 'order' => 10);
 }
Esempio n. 2
0
 function test_html()
 {
     $s =& $this->table1;
     $s->setValue('id', 10);
     $rel_list = new Dataface_RelatedList('Profiles', 'addresses');
     $out = $rel_list->toHtml();
     echo "here";
     if (PEAR::isError($out)) {
         echo $out->toString();
     }
     echo $out;
 }
Esempio n. 3
0
 function related_list($params, &$smarty)
 {
     import('Dataface/RelatedList.php');
     $query =& $this->app->getQuery();
     if (isset($params['record'])) {
         $record =& $params['record'];
     } else {
         $record =& $this->ENV['resultSet']->loadCurrent();
     }
     if (!$record) {
         throw new Exception('No record found from which to form related list.', E_USER_ERROR);
     }
     if (isset($params['relationship'])) {
         $relationship = $params['relationship'];
     } else {
         if (isset($query['-relationship'])) {
             $relationship = $query['-relationship'];
         } else {
             throw new Exception('No relationship specified for related list.', E_USER_ERROR);
         }
     }
     $relatedList = new Dataface_RelatedList($record, $relationship);
     echo $relatedList->toHtml();
 }
Esempio n. 4
0
 /**
  * Displays a list of related records.
  */
 function _relatedlist()
 {
     import('Dataface/RelatedList.php');
     $record =& $this->_resultSet->loadCurrent();
     if (!isset($this->_params['relationship'])) {
         return "<div class=\"error\">Error.  No relationship was specified.<!-- At line " . __LINE__ . " of file " . __FILE__ . " --></div>";
     }
     $list = new Dataface_RelatedList($record, $this->_params['relationship']);
     $res = $list->toHtml();
     if (PEAR::isError($res)) {
         return "<div class=\"error\">" . htmlspecialchars($res->toString()) . "</div>\n";
     }
     $relationship_menu = $this->_relationships_menu();
     return $res;
 }