/** * Event call to get content for public project page * * @param object $model * @return string */ public function onProjectPublicList($model) { if (!$model->exists() || !$model->isPublic()) { return; } $fields = Components\Projects\Models\Orm\Description\Field::all()->order('ordering', 'ASC')->rows(); $projectDescription = Components\Projects\Models\Orm\Description::all()->where('project_id', '=', $model->get('id'))->rows(); $info = array(); foreach ($fields as $field) { foreach ($projectDescription as $description) { if ($description->description_key == $field->name) { $f = new stdClass(); $f->label = $field->label; $f->value = $description->description_value; array_push($info, $f); } } } // Set vars $view = $this->view('public', 'view')->set('option', 'com_projects')->set('info', $info)->set('model', $model); return $view->loadTemplate(); }
?> </td> <?php echo $this->editor('about', $this->escape($this->model->about('raw')), 35, 25, 'about', array('class' => 'minimal no-footer')); ?> </label> </fieldset> <fieldset> <legend><?php echo ucwords(Lang::txt('COM_PROJECTS_EDIT_INFO_EXTENDED')); ?> </legend> <?php // Convert to XML so we can use the Form processor $xml = Components\Projects\Models\Orm\Description\Field::toXml($this->fields, 'edit'); // Create a new form Hubzero\Form\Form::addFieldPath(Component::path('com_projects') . DS . 'models' . DS . 'orm' . DS . 'description' . DS . 'fields'); $form = new Hubzero\Form\Form('description', array('control' => 'description')); $form->load($xml); $data = new stdClass(); $data->textbox = 'abd'; $data->projecttags = 'testing, tagging'; $form->bind($this->data); foreach ($form->getFieldsets() as $fieldset) { foreach ($form->getFieldset($fieldset->name) as $field) { echo $field->label; echo $field->input; echo $field->description; } }