BaseEventTypeController::renderElement PHP Method

renderElement() protected method

Render the individual element based on the action provided. Note that view names for the associated actions are set in the model.
protected renderElement ( BaseEventTypeElement $element, string $action, BaseCActiveBaseEventTypeCActiveForm $form, array $data, array $view_data = [], boolean $return = false, boolean $processOutput = false )
$element BaseEventTypeElement
$action string
$form BaseCActiveBaseEventTypeCActiveForm
$data array
$view_data array Data to be passed to the view.
$return boolean Whether the rendering result should be returned instead of being displayed to end users.
$processOutput boolean Whether the rendering result should be postprocessed using processOutput.
    protected function renderElement($element, $action, $form, $data, $view_data = array(), $return = false, $processOutput = false)
    {
        if (strcasecmp($action, 'PDFPrint') == 0 || strcasecmp($action, 'saveCanvasImages') == 0) {
            $action = 'print';
        }
        // Get the view names from the model.
        $view = isset($element->{$action . '_view'}) ? $element->{$action . '_view'} : $element->getDefaultView();
        $container_view = isset($element->{'container_' . $action . '_view'}) ? $element->{'container_' . $action . '_view'} : $element->getDefaultContainerView();
        $use_container_view = $element->useContainerView && $container_view;
        $view_data = array_merge(array('element' => $element, 'data' => $data, 'form' => $form, 'child' => $element->getElementType()->isChild(), 'container_view' => $container_view), $view_data);
        // Render the view.
        $use_container_view && $this->beginContent($container_view, $view_data);
        $this->renderPartial($this->getElementViewPathAlias($element) . $view, $view_data, $return, $processOutput);
        $use_container_view && $this->endContent();
    }

Usage Example

Esempio n. 1
0
 /**
  * Override action value when action is step to be update.
  *
  * @param BaseEventTypeElement                $element
  * @param string                              $action
  * @param BaseCActiveBaseEventTypeCActiveForm $form
  * @param array                               $data
  * @param array                               $view_data
  * @param bool                                $return
  * @param bool                                $processOutput
  */
 protected function renderElement($element, $action, $form, $data, $view_data = array(), $return = false, $processOutput = false)
 {
     if ($action == 'step') {
         $action = 'update';
     }
     $class_array = '';
     if (!empty($element)) {
         $cls = get_class($element);
         if (!empty($cls)) {
             $class_array = explode('\\', get_class($element));
         }
     }
     $active_check_value = "";
     if (!empty($class_array)) {
         if (array_pop($class_array) === 'Element_OphCiExamination_CataractSurgicalManagement') {
             $active_check = \SettingInstallation::model()->find('t.key="city_road_satellite_view"');
             if (!empty($active_check)) {
                 $active_check_value = $active_check->value;
             }
         }
     }
     $view_data = array_merge(array('active_check' => $active_check_value), $view_data);
     parent::renderElement($element, $action, $form, $data, $view_data, $return, $processOutput);
 }
All Usage Examples Of BaseEventTypeController::renderElement
BaseEventTypeController