Example #1
0
  public function generateContents($code)
  {
    $dataspace = $this->getDataspaceRefCode();

    $counter = '$' . $code->getTempVariable();
    $value = '$' . $code->getTempVariable();

    if (isset($this->attributes['hash_id']))
    {
      $code->writePhp($value . ' = trim(' . $this->getDataspaceRefCode() . '->get(\'' . $this->attributes['hash_id'] . '\'));');
    }
    else
    {
      if(!isset($this->attributes['value']))
        $this->attributes['value'] = 1;

      $code->writePhp($value . ' = ' . $this->attributes['value'] . ';');
    }

    $code->writePhp('for(' . $counter . '=0;' . $counter . ' < ' . $value . '; ' . $counter . '++){');

    parent :: generateContents($code);

    $code->writePhp('}');
  }
	public function postGenerate($code)
	{
		if(!count($this->_actions))
			parent :: postGenerate($code);
		$selector_id = uniqid(''); 
		
		$code->writeHtml("
		<select id='{$selector_id}'>
        <option value=''>");
		$code->writePhp("echo strings :: get('choose_action_for_selected_rows')");        
    $code->writeHtml("</option>");

		foreach($this->_actions as $option)
		{
			$action_path = $this->_getActionPath($option);
			$code->writeHtml("<option value='{$action_path}'>");
			if(isset($option['locale_value']))
			{
				$locale_file = '';
				if(isset($option['locale_file']))
					$locale_file = "','{$option['locale_file']}";
				$code->writePhp("echo strings :: get('" . $option['locale_value'] . $locale_file ."')");
			}
			else
				$code->writeHtml($option['name']);
			$code->writeHtml("</option>");
		}
		$code->writeHtml("</select>");
		$this->_renderButton($code, $selector_id);
    parent :: postGenerate($code);
	}
Example #3
0
  public function generateContents($code)
  {
    $code->writePhp('do { ');

    parent::generateContents($code);

    $code->writePhp('} while (' . $this->getDataspaceRefCode() . '->next());');
  }
  public function postGenerate($code)
  {
    if($this->isDebugEnabled())
    {
      $code->writeHtml('</div>');
    }

    parent :: postGenerate($code);
  }
  public function generateContents($code)
  {
    $value = $this->_typecastValue();

    $code->writePhp($this->parent->getComponentRefCode()
      . '->set_parameter("' . $this->attributes['name'] . '", '
      . var_export($value, true) . ')');

    parent::generateContents($code);
  }
  function generateContents(&$code)
  {
    $parent =& $this->findParentByClass('LimbPagerNavigatorTag');

    $code->writePhp('if (' . $parent->getComponentRefCode() . '->hasNext()) {');

    parent :: generateContents($code);

    $code->writePhp('}');
  }
  function generateContents(&$code)
  {
    $parent =& $this->findParentByClass('LimbPagerNavigatorTag');
    $code->writePhp('if (!' . $parent->getComponentRefCode() . '->isDisplayedPage()) {');

    $code->writePhp($this->getDataSourceRefCode() . '->set("href", ' . $parent->getComponentRefCode() . '->getPageUri());');
    $code->writePhp($this->getDataSourceRefCode() . '->set("number", ' . $parent->getComponentRefCode() . '->getPage());');

    parent :: generateContents($code);

    $code->writePhp('}');
  }
  function generateContents(&$code)
  {
    $counter = '$' . $code->getTempVariable();

    $value = $this->getAttribute('value');

    $code->writePhp('for(' . $counter . '=0;' . $counter . ' < ' . $value . '; ' . $counter . '++){');

    parent :: generateContents($code);

    $code->writePhp('}');
  }
Example #9
0
  public function postGenerate($code)
  {
    $code->writePhp('}');

    $emptychild = $this->findChildByClass('grid_default_tag');
    if ($emptychild)
    {
      $code->writePhp(' else { ');
      $emptychild->generateNow($code);
      $code->writePhp('}');
    }
    parent::postGenerate($code);
  }
  public function generateContents($code)
  {
    $dataspace = $this->getDataspaceRefCode();

    if (isset($this->attributes['hash_id']) &&  isset($this->attributes['target']))
    {
      if($target = $this->parent->findChild($this->attributes['target']))
      {
        $code->writePhp($target->getComponentRefCode() . '->register_dataset(new array_dataset(' . $dataspace . '->get("' . $this->attributes['hash_id'] . '")))');
      }
    }

    parent :: generateContents($code);
  }
Example #11
0
  public function generateContents($code)
  {
    $mapped = '$' . $code->getTempVariable();

    $code->writePhp("{$mapped} = Limb :: toolkit()->getFetcher()->fetchRequestedObject(Limb :: toolkit()->getRequest());");

    $code->writePhp("if(isset({$mapped}['actions']) && array_key_exists('print_version', {$mapped}['actions'])){");

    $code->writePhp($this->getDataspaceRefCode() . "->set('link', {$mapped}['path'] . '?action=print_version');");

    parent :: generateContents($code);

    $code->writePhp('}');
  }
Example #12
0
  public function generateContents($code)
  {
    if($this->isDebugEnabled())
    {
      $code->writeHtml("<div class='debug-tmpl-include'>");

      $this->_generateDebugEditorLinkHtml($code, $this->resolved_source_file);
    }

    parent :: generateContents($code);

    if($this->isDebugEnabled())
      $code->writeHtml('</div>');
  }
Example #13
0
 public function generateContents($code)
 {
   if (array_key_exists('even', $this->attributes))
   {
     $code->writePhp('if (!(' . $this->getDataspaceRefCode() . '->get_counter()%2)) {');
     parent :: generateContents($code);
     $code->writePhp('}');
   }
   elseif (array_key_exists('odd', $this->attributes))
   {
     $code->writePhp('if ((' . $this->getDataspaceRefCode() . '->get_counter()%2)) {');
     parent :: generateContents($code);
     $code->writePhp('}');
   }
 }
Example #14
0
  public function generateContents($code)
  {
    $file = 'common';

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

    if(isset($this->attributes['locale_type']))
    {
      if(strtolower($this->attributes['locale_type']) == 'content')
        $locale_constant = 'CONTENT_LOCALE_ID';
      else
        $locale_constant = 'MANAGEMENT_LOCALE_ID';
    }
    else
      $locale_constant = 'MANAGEMENT_LOCALE_ID';

    if(isset($this->attributes['hash_id']))
    {
      $locale_tmp = '$' . $code->getTempVariable();

      $code->writePhp(
        "{$locale_tmp} = " . $this->getDataspaceRefCode() . '->get("' . $this->attributes['hash_id'] . '");');

      if(defined('DEBUG_TEMPLATE_I18N_ENABLED') &&  constant('DEBUG_TEMPLATE_I18N_ENABLED'))
      {
        $code->writePhp("
          echo '<img src=\'/shared/images/i.gif\' title=\'&#039;{$locale_tmp}&#039; from &#039;{$file}_???&#039; i18n file\'>';"
        );
      }

      $code->writePhp("echo strings :: get({$locale_tmp}, '{$file}', constant('{$locale_constant}'));");

    }
    elseif(isset($this->attributes['name']))
    {
      if(defined('DEBUG_TEMPLATE_I18N_ENABLED') &&  constant('DEBUG_TEMPLATE_I18N_ENABLED'))
      {
        $code->writePhp("
          echo '<img src=\'/shared/images/i.gif\' title=\'&#039;{$this->attributes['name']}&#039; from &#039;{$file}_???&#039; i18n file\'>';"
        );
      }

      $code->writePhp("echo strings :: get('{$this->attributes['name']}', '{$file}', constant('{$locale_constant}'));");
    }

    parent :: generateContents($code);
  }
  function generateContents(&$code)
  {
    $dataspace =& $this->getDataSourceRefCode();

    $target_name = $this->getAttribute('target');
    $from = $this->getAttribute('from');

    if (!empty($from) && !empty($target_name))
    {
      if($target =& $this->parent->findChild($target_name))
      {
        $code->writePhp($target->getComponentRefCode() . '->registerDataSet(new PagedArrayDataset(' . $dataspace . '->get("' . $from . '")));');
      }
    }

    parent :: generateContents($code);
  }
Example #16
0
 function postGenerate($code)
 {
     $js = '';
     if (isset($this->attributes['active_tab'])) {
         $active_tab = $this->attributes['active_tab'];
     } else {
         $active_tab = reset($this->tabs);
     }
     if (!$this->tabs || !$active_tab || !in_array($active_tab, $this->tabs)) {
         return throw_error(new WactException('invalid tabs declaration. Check your tabs settings', array('tag' => $this->tag, 'file' => $this->source_file, 'line' => $this->starting_line_no)));
     }
     foreach ($this->tabs as $id) {
         $js .= "var tab_data={'id':'{$id}'};\n tabs.registerTabItem(tab_data);\n";
     }
     if ($this->use_cookie) {
         $js .= "if (active_tab = get_cookie('active_tab'))\n\r\n                tabs.activate(active_tab);\n\r\n              else\r\n                tabs.activate('{$active_tab}');\n";
     } else {
         $js .= "tabs.activate('{$active_tab}');\n";
     }
     $code->writeHtml("\r\n      <script type='text/javascript'>\r\n        var tabs = new tabs_container();\r\n        {$js}\r\n      </script>");
     parent::postGenerate($code);
 }
  public function preGenerate($code)
  {
    $value = '$' . $code->getTempVariable();
    $parent = $this->getDataspaceRefCode();

    $radio_child = $this->findChildByClass('input_tag');
    $label_child = $this->findChildByClass('label_tag');

    $radio = $radio_child->getComponentRefCode();
    $label = $label_child->getComponentRefCode();


    $code->writePhp("
    if ({$value} = {$parent}->get('id'))
    {
      {$radio}->set_attribute('value', {$value});
      {$radio}->set_attribute('id', {$value});
      {$label}->set_attribute('for', {$value});
    }
    ");

    parent :: preGenerate($code);
  }
Example #18
0
 public function postGenerate($code)
 {
     $code->writeHtml('
   </td></tr>
   </table>
 </div>');
     parent::postGenerate($code);
 }
Example #19
0
 public function postGenerate($code)
 {
   $code->writePhp('}');
   parent::postGenerate($code);
 }
 public function postGenerate($code)
 {
     $code->writeHtml("</div>");
     parent::postGenerate($code);
 }
 function postGenerate($code)
 {
     $tab_class = $this->parent->tab_class;
     $code->writeHtml("\r\n      </td>\r\n    </tr>\r\n    </table>\r\n    ");
     parent::postGenerate($code);
 }
 function postGenerate($code)
 {
     $code->writeHtml("</a></td>\r\n          </tr>\r\n          </table>\r\n        </td>\r\n    ");
     parent::postGenerate($code);
 }
  function preGenerate(&$code)
  {
    $code->writePHP($this->getComponentRefCode() . '->preserveState("' . $this->getAttribute('name') . '");');

    parent :: preGenerate($code);
  }
 public function generateContents($code)
 {
     $code->writePhp("echo Limb :: toolkit()->getUser()->get('{$this->attributes['name']}');");
     parent::generateContents($code);
 }
  public function generateContents($code)
  {
    $ref = $this->getComponentRefCode();

    $code->writeHtml("<table border='0' cellpadding='0' cellspacing='0' height='100%'><tr><td>");

    $i = '$' . $code->getTempVariable();
    $node_htm = '$' . $code->getTempVariable();
    $level = '$' . $code->getTempVariable();
    $levels_status = '$' . $code->getTempVariable();

    $code->writePhp(
      "{$node_htm} = '';
      {$level} = {$ref}->get('level');
      {$levels_status} = {$ref}->get('levels_status');
      "
    );

    $code->writePhp("
      for({$i}=1; {$i} < {$level}; {$i}++)
      {
        if(isset({$levels_status}[{$i}]) && {$levels_status}[{$i}])
          {$node_htm} .= \"" . TREE_SPACER_IMG . "\";
        else
          {$node_htm} .= \"" . TREE_LINE_IMG . "\";
      }
    ");

    $open_params = '$' . $code->getTempVariable();
    $close_params = '$' . $code->getTempVariable();
    $open_link = '$' . $code->getTempVariable();
    $close_link = '$' . $code->getTempVariable();
    $anchor = '$' . $code->getTempVariable();
    $next_img = '$' . $code->getTempVariable();
    $tmp = '$' . $code->getTempVariable();

    $code->writePhp("
      {$open_params}['id'] = {$ref}->get('node_id');
      {$open_params}['action'] = 'toggle';{$open_params}['expand'] = 1;
      {$close_params}['id'] = {$ref}->get('node_id');
      {$close_params}['action'] = 'toggle';{$close_params}['collapse'] = 1;
      {$anchor} = '#' . {$ref}->get('node_id');
      "
    );

    $code->writePhp("
      if({$ref}->get('is_last_child'))
      {
        {$open_link} = sprintf(\"" . TREE_END_P_IMG . "\", addUrlQueryItems(\$_SERVER['PHP_SELF'], {$open_params}) . {$anchor});
        {$close_link} = sprintf(\"" . TREE_END_M_IMG . "\", addUrlQueryItems(\$_SERVER['PHP_SELF'], {$close_params}) . {$anchor});
        {$next_img} = \"" . TREE_END_IMG . "\";
      }
      else
      {
        {$open_link} = sprintf(\"" . TREE_CROSS_P_IMG . "\", addUrlQueryItems(\$_SERVER['PHP_SELF'], {$open_params}) . {$anchor});
        {$close_link} = sprintf(\"" . TREE_CROSS_M_IMG . "\", addUrlQueryItems(\$_SERVER['PHP_SELF'], {$close_params}) . {$anchor});
        {$next_img} = \"" . TREE_CROSS_IMG . "\";
      }
    ");

    $code->writePhp("
      if(({$ref}->get('r')-{$ref}->get('l')) > 1)
      {
        if({$ref}->get('is_expanded'))
          {$node_htm} .= {$next_img};
        else
          {$node_htm} .= {$next_img};
      }
      else
          {$node_htm} .= {$next_img};
    ");

    $code->writePhp("echo '<a name=' . {$ref}->get('node_id') . '>';");

    $code->writePhp("echo {$node_htm};");

    $code->writeHtml("</td><td nowrap class='text'>");

    $img_alt = '$' . $code->getTempVariable();
    $img_htm = '$' . $code->getTempVariable();

    $code->writePhp("
      if(!{$ref}->get('img_alt'))
        {$img_alt} = {$ref}->get('identifier');
    ");

    $code->writePhp("echo
      \"<table border=0 cellspacing=0 cellpadding=0 height=100% style='display:inline'>
        <tr>
          <td><img src='/shared/images/1x1.gif' height=3 width=1></td>
        </tr>
        <tr>
        <td>\";
    ");

    $code->writePhp("echo
      \"</td></tr>\";
    ");
    $code->writePhp("
      echo \"<tr><td height=100% \";

      if(({$ref}->get('r')-{$ref}->get('l')) > 1)
      {
        if({$ref}->get('is_expanded'))
        {
          echo \" background='/shared/images/t_l.gif'\";
        }
      }

      echo \"></td></tr>\";
    ");

    $code->writePhp("echo \"</table>\";");

    $code->writeHtml("</td><td valign=top style='padding:6px 3px 3px 2px'>");

    if(!array_key_exists('nolink', $this->attributes))
      $code->writePhp("echo '<a href=' . {$ref}->get('url') . '>';");

    $code->writePhp("echo {$ref}->get('title');");

    if(!array_key_exists('nolink', $this->attributes))
      $code->writePhp("echo '</a>';");

    $code->writeHtml("</td></tr></table>");

    parent::generateContents($code);
  }
 public function generateContents($code)
 {
     $code->writePhp("if (!Limb :: toolkit()->getUser()->is_logged_in()) {");
     parent::generateContents($code);
     $code->writePhp("}");
 }
 /**
 * @param CodeWriter
 * @return void
 * @access protected
 */
 function postGenerate(&$code) {
   $code->writePHP('}');
   parent::postGenerate($code);
 }
  function postGenerate(&$code)
  {
    parent::postGenerate($code);

    $code->writePhp('}'. "\n");
  }
Example #29
0
  public function prepare()
  {
    $this->parent->wrapping_component = $this;

    parent :: prepare();
  }