ACC SHELL

Path : /srv/www/vhosts/alfa-com/modules/
File Upload :
Current File : /srv/www/vhosts/alfa-com/modules/_volna_mista.php

<?php
	class o__volna_mista extends object
	{
		public function initialize($phase)
		{
			parent::initialize($phase);
			
			if ($phase == 0)
			{
				$this->set('order', array('-ocreated'));
				$this->f('otitle')->get = 'return ($object->oid ? $object->title : "");';
	
				$f = $this->defineIdAutoIncrement();
				$f = $this->defineOCreated();
				//$f = $this->defineImage();
				$f = $this->defineStringLocalized('title');
				//$f = $this->defineTextLocalized('summary');
				$f = $this->defineTextLocalizedHTML('text');
				$f = $this->defineStringLocalized('datum_nastupu');
				
				$f = $this->defineV('url', Field::TYPE_STRING);
				$f->get = 'return (!$object->oid ? "" : (U::urlize($object->title) . "-" . $object->id));';
			}
		}
	}
	
	class _volna_mista extends ObjectModule
	{
		public function initialize($phase)
		{
			parent::initialize($phase);

			if ($phase == 4)
			{
				$this->action('list')->set('columns', array('title'));
				$this->action('list')->set('actions', array('new', 'edit', 'delete'));

				$this->action('get')->set('object-fields', array('id'));
				//$this->action('get')->set('page-size', 12);
			}
		}

		public function index($options = array())
		{
			Router::add(Router::TYPE_EQUALS, __('get-url'), array('page.location' => $this->id.'/get#list'));
			Router::add(Router::TYPE_REGEX, __('get-url').'([^/]*)-(\d+)', array('page.location' => $this->id.'/get#detail'), array('title', 'id'));
			Router::process();
			if (page()->location("~^{$this->id}/get~"))
				$this->mainTemplate();
		}

		public function page($options = array())
		{
			if (page()->location("~^{$this->id}/get~"))
			{
				page()->breadcrumb(__('module-name', $this->id), $this->url('get'));
				if (i()->get('id'))
					page()->breadcrumb($GLOBALS['result']['object']->oid ? $GLOBALS['result']['object']->otitle : __('not-found', '@core'));
				return true;
			}
		}

		public function url($action, $options = array(), $type = null)
		{
			if (($type == 'pager') && ($action == 'get'))
				return parent::url('get');
			else
				return parent::url($action, $options, $type);
		}

		/************************************************** ACTIONS **************************************************/

		
	}
?>

ACC SHELL 2018