コード例 #1
0
  public function renderAttributes()
  {
    $this->_processAttributes();

    if (!$this->path)
    {
      $action_path = $_SERVER['PHP_SELF'];

      if($node_id = Limb :: toolkit()->getRequest()->get('node_id'))
        $action_path .= '?node_id=' . $node_id;
    }
    else
      $action_path = $this->path;

    if (strpos($action_path, '?') === false)
      $action_path .= '?';
    else
      $action_path .= '&';

    if($this->action)
      $action_path .= 'action=' . $this->action;

    if ((bool)$this->reload_parent)
    {
      $action_path .= '&reload_parent=1';
    }

    $this->attributes['onclick'] = $this->onclick;
    $this->attributes['onclick'] .= "submitForm(this.form, '{$action_path}')";

    parent :: renderAttributes();

    unset($this->attributes['onclick']);
  }
コード例 #2
0
  /**
  * Overrides then calls with the parent render_attributes() method. Makes
  * sure there is always a value attribute, even if it's empty.
  * Called from within a compiled template render function.
  */
  public function renderAttributes()
  {
    $value = $this->getValue();

    if (!is_null($value))
    {
      $this->attributes['value'] = $value;
    }

    parent :: renderAttributes();
  }
コード例 #3
0
  /**
  * Overrides then calls with the parent render_attributes() method dealing
  * with the special case of the checked attribute
  */
  public function renderAttributes()
  {
    $value = $this->getValue();

    if ($value)
      $this->attributes['checked'] = 1;
    else
    unset($this->attributes['checked']);

    parent :: renderAttributes();
  }
コード例 #4
0
  /**
  * Overrides then calls with the parent render_attributes() method dealing
  * with the special case of the checked attribute
  */
  public function renderAttributes()
  {
    $value = $this->getValue();

    if (isset($this->attributes['value']) &&  $value == $this->attributes['value'])
    {
      $this->attributes['checked'] = 1;
    }
    else
    {
      unset($this->attributes['checked']);
    }
    parent::renderAttributes();
  }
コード例 #5
0
  public function renderAttributes()
  {
    if (!isset($this->attributes['path']) ||  !$this->attributes['path'])
    {
      $action_path = $_SERVER['PHP_SELF'];

      $request = Limb :: toolkit()->getRequest();

      if($node_id = $request->get('node_id'))
        $action_path .= '?node_id=' . $node_id;
    }
    else
      $action_path = $this->attributes['path'];

    if (strpos($action_path, '?') === false)
      $action_path .= '?';
    else
      $action_path .= '&';

    if(isset($this->attributes['action']))
      $action_path .= 'action=' . $this->attributes['action'];

    if (isset($this->attributes['reload_parent']) &&  $this->attributes['reload_parent'])
    {
      $action_path .= '&reload_parent=1';
      unset($this->attributes['reload_parent']);
    }

    if(!isset($this->attributes['onclick']))
      $this->attributes['onclick'] = '';

    $this->attributes['onclick'] .= "submitForm(this.form, '{$action_path}')";

    unset($this->attributes['path']);
    unset($this->attributes['action']);

    parent :: renderAttributes();
  }