Exemple #1
0
 /**
  * Add the menu items to the administrator menu for the application
  *
  * @param AppMenu $menu The menu object
  *
  * @since 2.0
  */
 public function addMenuItems($menu)
 {
     // get current controller
     $controller = $this->app->request->getWord('controller');
     $controller = in_array($controller, array('new', 'manager')) ? 'item' : $controller;
     // create application tab
     $tab = $this->app->object->create('AppMenuItem', array($this->id, $this->name, $this->app->link(array('controller' => $controller, 'changeapp' => $this->id))));
     $menu->addChild($tab);
     // menu items
     $items = array('item' => JText::_('Items'), 'category' => JText::_('Categories'), 'frontpage' => JText::_('Frontpage'), 'comment' => JText::_('Comments'), 'tag' => JText::_('Tags'), 'submission' => JText::_('Submissions'));
     // remove unauthorized menu items
     if (!$this->canManageCategories()) {
         unset($items['category']);
     }
     if (!$this->canManageFrontpage()) {
         unset($items['frontpage']);
     }
     if (!$this->canManageComments()) {
         unset($items['comment']);
     }
     if (!$this->isAdmin()) {
         unset($items['submission']);
     }
     // add menu items
     foreach ($items as $controller => $name) {
         $tab->addChild($this->app->object->create('AppMenuItem', array($this->id . '-' . $controller, $name, $this->app->link(array('controller' => $controller, 'changeapp' => $this->id)))));
     }
     // add config menu item
     if ($this->isAdmin()) {
         $id = $this->id . '-configuration';
         $link = $this->app->link(array('controller' => 'configuration', 'changeapp' => $this->id));
         $config = $this->app->object->create('AppMenuItem', array($id, JText::_('Config'), $link));
         $config->addChild($this->app->object->create('AppMenuItem', array($id, JText::_('Application'), $link)));
         $config->addChild($this->app->object->create('AppMenuItem', array($id . '-importexport', JText::_('Import / Export'), $this->app->link(array('controller' => 'configuration', 'changeapp' => $this->id, 'task' => 'importexport')))));
         $tab->addChild($config);
     }
     // trigger event for adding custom menu items
     $this->app->event->dispatcher->notify($this->app->event->create($this, 'application:addmenuitems', array('tab' => &$tab)));
 }
Exemple #2
0
			<div id="app_footer">				
				<div class="app_footer_menu">
					<ul>
						<?php 
if (App::getTotalApiCalls()) {
    ?>
						<li><a href="#" class="app_live_call_show"><?php 
    echo App::getTotalApiCalls();
    ?>
 Live API Call(s)</a></li>
						<li>&middot;</li>
						<?php 
}
?>
						<li><a href="<?php 
echo App::link('aboutus');
?>
" class="app_js" rel="aboutus">About Us</a></li>
					</ul>
				</div>
				<?php 
echo APP_SITE_NAME;
?>
 &copy; <?php 
echo date('Y', App::getTime());
?>
			</div>
		</div>
		
		<div class="app_dev_holder">
			<div class="app_holder">
Exemple #3
0
 /**
  * Evaluates the fields and returns them in HTML
  *
  * @param array $fields The fields to process
  *
  * @return string The HTML fields string
  */
 function renderFields($fields)
 {
     // process XML
     if (is_object($fields)) {
         $fields = $this->parseXML($fields);
         // process json string
     } else {
         if ($result = $this->decodeJSON($fields)) {
             $fields = $result;
             // process file
         } else {
             if ($path = $this->app->path->path($fields)) {
                 $ext = pathinfo($path, PATHINFO_EXTENSION);
                 if ($ext == 'json') {
                     $fields = file_get_contents($path);
                 } else {
                     // php
                     $fields = (include $path);
                 }
                 $fields = $this->decodeJSON($fields);
             }
         }
     }
     // check if it's array, if not cancel and raise notice
     if (!is_array($fields)) {
         $this->app->error->raiseError(500, JText::_('Something went wrong. Could be a bad fields format or file not found.'));
         return;
     }
     $result = array();
     foreach ($fields as $id => $fld) {
         $fld = $this->app->data->create($fld);
         // adjust ctrl
         // if($adjust = $fld->get('adjust_ctrl')){
         // 	$final_ctrl = preg_replace($adjust['pattern'], $adjust['replacement'], $ctrl);
         // } else {
         // 	$final_ctrl = $ctrl;
         // }
         // wrapper control if any
         // $final_ctrl = $fld->get('control') ? $final_ctrl.'['.$fld->get('control', '').']' : $final_ctrl;
         $field_type = $fld->get('type', '');
         switch ($field_type) {
             case 'separator':
                 // set layout
                 $layout = $fld->get('layout', 'default');
                 // backward compatibility
                 if ($fld->get('text')) {
                     $layout = $fld->get('big') ? 'section' : 'subsection';
                     $fld->set('specific', array('title' => $fld->get('text')));
                 }
                 // render layout
                 $field = $fld;
                 if ($layout = $this->getLayout("separator/{$layout}.php")) {
                     $result[] = $this->app->zlfw->renderLayout($layout, compact('id', 'field'));
                 }
                 break;
             case 'wrapper':
             case 'control_wrapper':
             case 'toggle':
             case 'fieldset':
                 // backward compatibility
                 // get content
                 $content = array_filter($this->renderFields($fld->get('fields')));
                 // abort if no minimum fields reached
                 if (count($content) == 0 || count($content) < $fld->get('min_count', 0)) {
                     continue;
                 }
                 // init vars
                 $layout = $fld->get('layout', 'default');
                 $content = implode("\n", $content);
                 // backward compatibility
                 if ($field_type == 'control_wrapper') {
                     $result[] = $content;
                     continue;
                 } else {
                     if ($field_type == 'fieldset') {
                         $layout = 'fieldset';
                     } else {
                         if ($field_type == 'toggle') {
                             $layout = 'toggle';
                         }
                     }
                 }
                 // render layout
                 if ($this->renderIf($fld->get('renderif')) && ($layout = $this->getLayout("wrapper/{$layout}.php"))) {
                     $result[] = $this->app->zlfw->renderLayout($layout, compact('id', 'content', 'fld'));
                 }
                 break;
             case 'subfield':
                 // get parent fields data
                 $psv = $this->app->data->create($psv);
                 // replace path {value} if it's string
                 $paths = is_string($psv->get($pid)) ? str_replace('{value}', basename($psv->get($pid), '.php'), $fld->get('path')) : $fld->get('path');
                 // replace parent values in paths
                 foreach ((array) $psv as $key => $pvalue) {
                     $paths = str_replace('{' . $key . '}', basename(@(string) $pvalue, '.php'), $paths);
                 }
                 // build json paths
                 $json = array('paths' => $paths);
                 // create possible arguments objects
                 if ($field_args = $fld->get('arguments')) {
                     foreach ($field_args as $name => $args) {
                         $arguments[$name] = $this->app->data->create($args);
                     }
                 }
                 // parse fields
                 if ($res = $this->renderFields($json)) {
                     $result[] = $res;
                 }
                 break;
             default:
                 // init vars
                 $value = null;
                 // check old values
                 // if($fld->get('check_old_value'))
                 // {
                 // 	// adjust ctrl for old value
                 // 	$old_value_ctrl = $this->control;
                 // 	if($adjust = $fld->find('check_old_value.adjust_ctrl')) $old_value_ctrl = preg_replace($adjust['pattern'], $adjust['replacement'], $old_value_ctrl);
                 // 	// get old value
                 // 	// $value = $this->getFieldValue($fld->find('check_old_value.id'), null, $old_value_ctrl);
                 // 	// translate old value
                 // 	if($translations = $fld->find('check_old_value.translate_value')){
                 // 		foreach($translations as $key => $trans) if($value == $key){
                 // 			if($trans == '_SKIPIT_'){
                 // 				$value = null;
                 // 				break;
                 // 			} else {
                 // 				$value = $trans;
                 // 				break;
                 // 			}
                 // 		}
                 // 	}
                 // }
                 // get inital value dinamicly
                 if (empty($value) && $fld->get('request_value')) {
                     // from url
                     if ($fld->find('request_value.from') == 'url') {
                         $value = $this->request->get($fld->find('request_value.param'), $fld->find('request_value.type'), $fld->find('request_value.default'));
                     }
                 }
                 // if ($psv) $specific['parents_val'] = $psv;
                 $args = $this->app->data->create($fld->get('settings'));
                 // render field
                 $result[] = $this->renderField($fld, $id, $value, $args);
                 // load childs
                 if ($childs = $fld->find('childs.loadfields')) {
                     // create parent values
                     $pid = $id;
                     // add current value to parents array, if empty calculate it
                     // $psv[$id] = $value ? $value : $this->field($params, $value, true);
                     $psv[$id] = $value ? $value : null;
                     $p_task = $this->request->getVar('parent_task') ? $this->request->getVar('parent_task') : $this->request->getVar('task');
                     // parent task necesary if double field load ex: layout / sublayout
                     $url = $this->app->link(array('controller' => 'zlframework', 'format' => 'raw', 'type' => $this->type, 'layout' => $this->layout, 'group' => $this->group, 'path' => $this->request->getVar('path'), 'parent_task' => $p_task, 'zlfieldmode' => $this->mode), false);
                     // rely options to be used by JS later on
                     $json = $fld->find('childs.loadfields.subfield', '') ? array('paths' => $fld->find('childs.loadfields.subfield.path')) : array('fields' => $childs);
                     $pr_opts = json_encode(array('id' => $id, 'url' => $url, 'psv' => $psv, 'json' => json_encode($json)));
                     // all options are stored as data on DOM so can be used from JS
                     $loaded_fields = $this->renderFields($childs);
                     $result[] = '<div class="placeholder" data-relieson-type="' . $field_type . '"' . ($pr_opts ? " data-relieson='{$pr_opts}'" : '') . ' data-control="' . $this->control . '" >';
                     $result[] = $loaded_fields ? '<div class="loaded-fields">' . $loaded_fields . '</div>' : '';
                     $result[] = '</div>';
                 }
         }
     }
     return $result;
 }
Exemple #4
0
            }
        } else {
            $sError = 'Unable to upload the photo.';
        }
    }
    if (!empty($sError)) {
        echo '<script type="text/javascript">window.parent.$App.error(\'photo\', \'' . $sError . '\');</script>';
    }
    exit;
}
if (!App::isAjax()) {
    ?>
 
<div class="app_form">
	<form method="post" action="<?php 
    echo App::link('photos');
    ?>
" enctype="multipart/form-data" target="app_iframe_src">
		<div id="app_form_photo_upload_holder">
			<div class="app_form_input">
				Share a Photo
			</div>		
			<input type="file" name="photo" id="app_form_photo_upload" />
		</div>		
		<div class="app_form_hidden">
			<textarea cols="60" rows="10" name="status" id="app_form_status" placeholder="Say something about this photo..."></textarea>
			<div class="app_submit">
				<input type="submit" value="Share" class="app_button" onclick="$('.app_form_process').show();" />
				<div class="app_form_process"></div>
			</div>
		</div>