public function __construct($options = array())
 {
     parent::__construct($options);
     $this->setState('find_properties_by', KInput::get('find_properties_by', 'get', 'string'));
     $this->setState('type_id', KInput::get('type_id', 'get', 'int'));
     $this->setState('id', KInput::get('id', 'get', 'int'));
 }
Example #2
0
 public function display($tpl = null)
 {
     // Request
     $month = KInput::get('month', 'get', 'digit', null, date('m'));
     $year = KInput::get('year', 'get', 'int', null, date('Y'));
     $graph = KInput::get('graph', 'get', 'cmd', null, 'translations');
     $table_name = KInput::get('table_name', 'get', KFactory::tmp('admin::com.nooku.filter.tablename'), null, '');
     $this->assign('graph', $graph);
     $this->assign('table_name', $table_name);
     $this->assign('month', $month);
     $this->assign('year', $year);
     // URI
     $uri =& JURI::getInstance(JURI::base() . 'index.php?option=com_nooku&format=openflashchart');
     $uri->setVar('table_name', $table_name);
     $uri->setVar('layout', 'bar');
     $uri->setVar('view', 'statistics.translations');
     $this->assign('translations', $uri->toString());
     $uri->setVar('year', date('Y'));
     $uri->setVar('month', date('n'));
     $uri->setVar('view', 'statistics.translators');
     $this->assign('translators', $uri->toString());
     // panes
     Koowa::import('lib.joomla.html.pane');
     $this->assignRef('panes', JPane::getInstance('tabs'));
     // Mixin a menubar object
     $this->mixin(new NookuMixinMenu($this));
     $this->displayMenubar();
     $this->displayMenutitle();
     $this->displayToolbar();
     // Display the layout
     parent::display($tpl);
 }
Example #3
0
 public function display($tpl = null)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $model = KFactory::get('admin::com.nooku.model.translators');
     // Get data from model
     $stats = $model->getStats();
     $dates = $model->getDates();
     // Get translators
     $translators = $nooku->getTranslators();
     // Get the languages
     //$primary       = $nooku->getPrimaryLanguage();
     $languages = $nooku->getLanguages();
     //unset($languages[$primary->iso_code]); // we don't display the primary lang in our chart
     // Request
     $table_name = KInput::get('table_name', 'get', KFactory::tmp('admin::com.nooku.filter.tablename'));
     $user_id = KInput::get('user_id', 'get', 'int');
     if (!$user_id) {
         throw new KViewException('user_id is required in ' . JURI::getInstance()->toString());
     }
     // Utilities
     $color = new NookuConfigColor();
     // get the chart
     $c = $this->getChart('line');
     // Data
     $i = 1;
     foreach ($stats[$user_id]->count as $value) {
         $c->setData($i++, $value);
     }
     // Layout
     $c->SetLineSize(5);
     // The Sparkline lib always draws in black, this hack lets us use other colors
     $c->setColor('black', $color->get('blue'));
     parent::display();
 }
Example #4
0
 public function display($tpl = null)
 {
     $component = JComponentHelper::getComponent('com_formules');
     $params = new JParameter($component->params);
     $data['6'] = KInput::get('field_6', 'post', 'string', '', 'yyyy-mm-dd');
     $data['7'] = KInput::get('field_7', 'post', 'string', '', 'yyyy-mm-dd');
     $data['8'] = KInput::get('field_8', 'post', 'string', '', 'yyyy-mm-dd');
     $data['6_'] = KInput::get('field_6', 'post', 'string', '', 'yyyy-mm-dd');
     $data['7_'] = KInput::get('field_7', 'post', 'string', '', 'yyyy-mm-dd');
     $data['8_'] = KInput::get('field_8', 'post', 'string', '', 'yyyy-mm-dd');
     $data['12'] = KInput::get('field_12', 'post', 'boolean', '', 'false');
     $data['13'] = KInput::get('field_13', 'post', 'string', '', '0');
     $data['14'] = KInput::get('field_14', 'post', 'boolean', '', 'false');
     $data['15'] = KInput::get('field_15', 'post', 'string', '', '0');
     $data['16'] = KInput::get('field_16', 'post', 'string', '', '0');
     $data['18'] = KInput::get('field_18', 'post', 'string', '', '0');
     $data['19'] = KInput::get('field_19', 'post', 'string', '', '0');
     $data['20'] = KInput::get('field_20', 'post', 'string', '', '0');
     $data['21'] = KInput::get('field_21', 'post', 'string', '', '0');
     $data['22'] = KInput::get('field_22', 'post', 'string', '', '0');
     $data['23'] = KInput::get('field_23', 'post', 'string', '', '0');
     $data['24'] = KInput::get('field_24', 'post', 'string', '', '0');
     $data['26'] = KInput::get('field_26', 'post', 'string', '', '0');
     $data['38'] = KInput::get('field_38', 'post', 'string', '', '0');
     //var_dump($data); die;
     $this->assignRef('data', $data);
     $this->assignRef('params', $params);
     // Display the layout
     parent::display($tpl);
 }
Example #5
0
 public function display($tpl = null)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $model = KFactory::get('admin::com.nooku.model.translations');
     // Get data
     $stats = $model->getStats();
     $iso_code = KInput::get('iso_code', 'get', 'lang');
     // Requested table
     $table_name = KInput::get('table_name', 'get', KFactory::tmp('admin::com.nooku.filter.tablename'));
     // Utilities
     $color = new NookuConfigColor();
     // get the chart
     $c = $this->getChart('bar');
     $c->setColor('red', $color->get('red'));
     $c->setColor('blue', $color->get('blue'));
     $c->setColor('yellow', $color->get('yellow'));
     $c->setColor('green', $color->get('green'));
     $c->SetBarWidth(5);
     $c->SetBarSpacing(1);
     $c->setData(0, $stats['MISSING'][$iso_code], 'red');
     $c->setData(1, $stats['OUTDATED'][$iso_code], 'yellow');
     $c->setData(2, $stats['COMPLETED'][$iso_code], 'green');
     $c->setData(3, $stats['ORIGINAL'][$iso_code], 'blue');
     return parent::display();
 }
Example #6
0
 /**
  * Proxy the router parse function to fix a bug in the core
  *
  * @param	object	$url	The URI to parse
  * @return	array
  */
 public function parse($uri)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $app = KFactory::get('lib.joomla.application');
     // Perform the actual parse
     $result = parent::parse($uri);
     $this->setVars($result);
     // Redirect if the language has changed
     $old = $nooku->getLanguage();
     $new = KInput::get('lang', array('post', 'get'), 'lang');
     if (isset($new) && strtolower($new) != strtolower($old)) {
         //Set the language
         $nooku->setLanguage($new);
         if (KInput::getMethod() == 'POST') {
             $uri->setVar('lang', $new);
             $route = JRoute::_($uri->toString(), false);
             /*
              * Dirty hack. Joomla URI class transforms cid[] into cid[0]
              * 
              * TODO : either fix in KUri or in the koowa javascript uri parser
              */
             $route = str_replace('cid[0]', 'cid[]', $route);
             $app->redirect($route);
         }
     }
     return $result;
 }
 public function __construct($options = array())
 {
     parent::__construct($options);
     $this->setState('album', KInput::get('album', 'get', 'string'));
     $this->setState('id', KInput::get('id', 'get', 'int'));
     JPluginHelper::importPlugin('gdata', 'gdata');
 }
Example #8
0
 public function onApplicationBeforeRender(ArrayObject $args)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     // Input
     $view = KInput::get('view', array('post', 'get'), 'cmd');
     $task = KInput::get('task', array('post', 'get'), 'cmd');
     $format = KInput::get('format', array('post', 'get'), 'cmd', null, 'html');
     $component = KInput::get('option', array('post', 'get'), 'cmd');
     // onBeforeRender
     if ('html' != $format || $task == 'edit') {
         return;
     }
     $table_name = 'menu';
     $row_id = KInput::get('Itemid', array('post', 'get'), 'int');
     if ($view == 'article' && $component == 'com_content') {
         $table_name = 'content';
         $row_id = KInput::get('id', 'get', 'slug');
     }
     $query = KFactory::get('lib.joomla.database')->getQuery()->select(array('m.*', 'n.*', 'm.nooku_node_id AS id'))->from('nooku_metadata AS m')->join('LEFT', 'nooku_nodes AS n', 'n.nooku_node_id = m.nooku_node_id')->where('row_id', '=', $row_id)->where('table_name', '=', $table_name)->where('iso_code', '=', $nooku->getLanguage());
     $meta = KFactory::get('admin::com.nooku.table.metadata')->fetchRow($query);
     // get head data
     $doc = KFactory::get('lib.joomla.document');
     $head = $doc->getHeadData();
     $head['description'] = empty($meta->description) ? @$head['description'] : $meta->description;
     $head['metaTags']['standard']['keywords'] = empty($meta->keywords) ? @$head['metaTags']['standard']['keywords'] : $meta->keywords;
     $head['metaTags']['standard']['author'] = empty($meta->author) ? @$head['metaTags']['standard']['author'] : $meta->author;
     $doc->setHeadData($head);
 }
Example #9
0
 /**
  * Returns a row with keywords, description and author, based on the 
  * tablename and row_id from the nodes table
  * 
  * @return 	object
  */
 public function getItem()
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $table_name = KInput::get('table_name', array('get', 'post'), 'cmd');
     $row_id = KInput::get('row_id', array('get', 'post'), 'int');
     $query = $this->getDBO()->getQuery()->select(array('m.*', 'n.*'))->from('nooku_metadata AS m')->join('RIGHT', 'nooku_nodes AS n', 'n.nooku_node_id = m.nooku_node_id')->where('row_id', '=', $row_id)->where('table_name', '=', $table_name);
     $result = $this->getTable()->fetchAll($query);
     //Get the row
     $item = $result->findRow('iso_code', $nooku->getLanguage());
     //If no existing row was found populate it
     if (!$item->id) {
         $original = $result->findRow('iso_code', $nooku->getPrimaryLanguage()->iso_code);
         if ($original->id) {
             $item->description = $original->description;
             $item->keywords = $original->keywords;
             $item->author = $original->author;
         } else {
             $app = KFactory::get('lib.joomla.application');
             $item->description = $app->getCfg('MetaDesc');
             $item->keywords = $app->getCfg('MetaKeys');
             $item->author = KFactory::get('lib.joomla.user')->name;
         }
         $item->table_name = $table_name;
         $item->row_id = $row_id;
     }
     return $item;
 }
Example #10
0
 public function save()
 {
     //KSecurityToken::check() or die('Invalid token or time-out, please try again');
     $item = KFactory::get('admin::com.nooku.model.metadata')->getItem();
     $item->description = KInput::get('metadesc', 'post', 'raw', 'string');
     $item->keywords = KInput::get('metakey', 'post', 'raw', 'string');
     $item->save();
 }
Example #11
0
 /**
  * Check if a valid token was submitted
  *
  * @return	boolean	True on success
  */
 public static function check()
 {
     // Using getVar instead of getString, because if the request is not a string,
     // we consider it a hacking attempt
     $req = KInput::get('_token', 'post', 'md5');
     $token = self::get();
     return $req === $token;
 }
 public function getFilters()
 {
     $filter = parent::getFilters();
     $filter['purpose_id'] = KInput::get('filter_purpose_id', 'post', 'int');
     $filter['project_id'] = KInput::get('filter_project_id', 'post', 'int', '', -1);
     $filter['state'] = KInput::get('filter_state', 'post', 'string');
     $filter['search'] = KInput::get('search', 'post', 'string');
     return $filter;
 }
 public function getDefaultState()
 {
     $state = parent::getDefaultState();
     $state['user_id'] = KInput::get('user_id', 'get', 'int', null, 0);
     $state['year'] = KInput::get('year', 'get', 'int', null, date('Y'));
     $state['month'] = KInput::get('month', 'get', 'digit', null, date('m'));
     $state['table_name'] = KInput::get('table_name', 'get', KFactory::tmp('admin::com.nooku.filter.tablename'), null, '');
     return $state;
 }
 public function display($tpl = null)
 {
     $model = KFactory::get('admin::com.nooku.model.translations');
     $this->assign('data', $model->getStats());
     $this->assign('languages', KFactory::get('admin::com.nooku.model.nooku')->getLanguages());
     $this->assign('color', new NookuConfigColor());
     $this->assign('table_name', KInput::get('table_name', 'get', KFactory::tmp('admin::com.nooku.filter.tablename')));
     parent::display($tpl);
 }
Example #15
0
 public function getFilters()
 {
     $filter = parent::getFilters();
     $filter['tag_id'] = KInput::get('filter_tag_id', 'post', 'int');
     $filter['category_id'] = KInput::get('filter_category_id', 'post', 'int');
     $filter['state'] = KInput::get('filter_state', 'post', 'string');
     $filter['search'] = KInput::get('search', 'post', 'string');
     return $filter;
 }
 public function delete()
 {
     $cid = KInput::get('cid', 'post', 'array.ints', null, array());
     JPluginHelper::importPlugin('gdata', 'gdata');
     foreach ($cid as $id) {
         $userFeed = plgSystemGdata::deleteAlbumEntry('immotoa_realisation_' . $id);
     }
     parent::delete();
 }
Example #17
0
 public function onApplicationAfterRender(ArrayObject $args)
 {
     // only insert the js when editing a menu item
     if (KInput::get('task', 'get', 'cmd') == 'edit') {
         $buffer = JResponse::getBody();
         $buffer = str_replace('new Accordion', 'document.accordion = new Accordion', $buffer);
         JResponse::setBody($buffer);
     }
 }
Example #18
0
 public function onApplicationBeforeRedirect(ArrayObject $args)
 {
     if (in_array(KInput::get('task', 'post', 'cmd'), array('save'))) {
         $id = KInput::get('id', array('get', 'post'), 'int');
         KInput::set('table_name', 'content', 'post');
         KInput::set('row_id', $id, 'post');
         $controller = KFactory::get('site::com.nooku.controller.metadata');
         $controller->execute('save');
     }
 }
Example #19
0
 public function onApplicationAfterRender(ArrayObject $args)
 {
     parent::onApplicationAfterRender($args);
     // only insert the js when editing a menu item
     if (in_array(KInput::get('task', array('get', 'post'), 'cmd'), array('edit', 'add'))) {
         $buffer = JResponse::getBody();
         $buffer = str_replace('new Accordion', 'document.accordion = new Accordion', $buffer);
         JResponse::setBody($buffer);
     }
 }
Example #20
0
 public function enable()
 {
     KSecurityToken::check() or die('Invalid token or time-out, please try again');
     $cid = KInput::get('cid', 'post', 'array.ints');
     $enable = $this->getTask() == 'enable' ? 1 : 0;
     if (count($cid) < 1) {
         throw new KControllerException(JText::sprintf('Select a item to %s', JText::_($this->getTask()), true));
     }
     KFactory::get('admin::com.nooku.model.translators')->enable($enable, $cid);
     $this->setRedirect('view=translators');
 }
Example #21
0
 /**
  * Proxy the router parse function to fix a bug in the core
  *
  * @param	object	$url	The URI to parse
  * @return	array
  */
 public function parse($uri)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $app = KFactory::get('lib.joomla.application');
     // Fool the parent in thinking we are coming in through index
     $path = $uri->getPath();
     $path = str_replace('index2.php', 'index.php', $path);
     $uri->setPath($path);
     // Perform the actual parse
     $result = parent::parse($uri);
     $result = $this->_parseSegments($result);
     $this->setVars($result);
     //Get the active languages
     $languages = $nooku->getLanguages();
     if (count($languages) > 1) {
         // Redirect if the language has changed
         if (KInput::getMethod() == 'POST') {
             $old = $nooku->getLanguage();
             $new = KInput::get('lang', array('post', 'get'), 'lang');
             if (isset($new) && strtolower($new) != strtolower($old)) {
                 //Set the language
                 $nooku->setLanguage($new);
                 //Force a reload on the menu
                 $menu = $app->getMenu();
                 $menu->load();
                 $result = $this->_translateSegments($result);
                 $this->setVars($result);
                 $app->redirect(JRoute::_('&lang=' . $new, false));
             }
         }
         //Set the language
         $nooku->setLanguage($result['lang']);
         //Set language in case no language information cannot be found
         if (empty($result['lang']) && !is_null($result['lang'])) {
             $result['lang'] = $nooku->getLanguage();
             $uri->setQuery($result);
             $this->setVars($result);
             /*
              * Redirect if language information is empty
              * 
              * This fix was added to deal with forms that don't use JRoute in the action.
              * for example mod_search.
              */
             if (JRequest::getMethod() != 'POST') {
                 $app->redirect(JRoute::_('index.php' . $uri->toString(array('query')), false));
             }
         }
         //Error : language cannot be found
         if (is_null($result['lang']) || !isset($languages[$result['lang']])) {
             throw new KProxyJoomlaException(JText::_("Language Not Found"));
         }
     }
     return $result;
 }
Example #22
0
 public function onAfterRoute()
 {
     if (!self::canEnable()) {
         return;
     }
     //Replace the document object
     $lang = KFactory::get('lib.joomla.language');
     $options = array('charset' => 'utf-8', 'language' => $lang->getTag(), 'direction' => $lang->isRTL() ? 'rtl' : 'ltr');
     $format = KInput::get('format', 'GET', 'word', 'word', 'html');
     $doc =& JFactory::getDocument();
     $doc = KFactory::get('lib.koowa.document.' . $format, $options);
 }
Example #23
0
 public function add()
 {
     KSecurityToken::check() or die('Invalid token or time-out, please try again');
     $model = KFactory::get('admin::com.nooku.model.tables');
     $tbl = KFactory::get('admin::com.nooku.table.tables');
     $cid = KInput::get('cid', 'post', 'array.cmd');
     $tables = $model->getTableData($cid);
     foreach ($tables as $table) {
         $tbl->insert($table);
     }
     $this->setRedirect('view=tables');
 }
Example #24
0
 public function onApplicationAfterRoute(ArrayObject $args)
 {
     if (KInput::getMethod() != 'POST') {
         return;
     }
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $old = $nooku->getLanguage();
     $new = KInput::get('lang', array('post', 'get'), 'lang');
     //Set the language
     if (!empty($new) && $new != $old) {
         $nooku->setLanguage($new);
     }
 }
Example #25
0
 public function delete()
 {
     $cid = KInput::get('cid', 'post', 'array.ints', null, array());
     JPluginHelper::importPlugin('gdata', 'gdata');
     $userFeed = plgSystemGdata::getUserFeed();
     foreach ($cid as $id) {
         // Remove albums from Picasa Server
         foreach ($userFeed as $userEntry) {
             if ($userEntry->title->text == "duuka_item_" . $id) {
                 $userEntry->delete();
             }
         }
     }
     parent::delete();
 }
Example #26
0
 public function save()
 {
     //Create the redirect URL
     $redirect = '&view=language&layout=form&id=' . KInput::get('id', 'get', 'int');
     try {
         $prefix = KInput::get('iso_code_lang', 'post', 'alpha');
         $suffix = KInput::get('iso_code_country', 'post', 'alpha');
         // Recombine the iso_code
         KInput::set('iso_code', strtolower($prefix) . '-' . strtoupper($suffix), 'post');
     } catch (KInputException $e) {
         $this->setRedirect($redirect, JText::_('The ISO code should consist of the language code and the country code (two letters each), eg "en-GB".'));
         return;
     }
     if (!trim(KInput::get('name', 'post', 'string')) || !trim(KInput::get('alias', 'post', 'string'))) {
         $this->setRedirect($redirect, JText::_('Please enter a name and an alias.'));
         return;
     }
     return parent::save();
 }
Example #27
0
 /**
  * Loads the entire menu table into memory
  */
 public function load()
 {
     $cache = KFactory::tmp('lib.joomla.cache', array('sys_menu', 'output'));
     if (!($data = $cache->get('items'))) {
         $db = KFactory::get('lib.joomla.database');
         $nooku = KFactory::get('admin::com.nooku.model.nooku');
         $primary = $nooku->getPrimaryLanguage();
         $lang = KInput::get('lang', array('post', 'get'), 'lang', null, $primary->iso_code);
         $sql = 'SELECT m.*, c.`option` as component' . ' FROM #__menu AS m' . ' LEFT JOIN #__components AS c ON m.componentid = c.id' . ' WHERE m.published = 1' . ' ORDER BY m.sublevel, m.parent, m.ordering';
         $db->select($sql);
         $items = $db->loadObjectList('id');
         $query = $db->getQuery()->select(array('row_id', 'status'))->from('nooku_nodes')->where('table_name', '=', 'menu')->where('iso_code', '=', $lang);
         $db->select($query);
         $nodes = $db->loadObjectList('row_id');
         foreach ($items as $item) {
             //Get parent information
             $parent_route = '';
             $parent_tree = array();
             if (($parent = $item->parent) && isset($items[$parent]) && is_object($items[$parent]) && isset($items[$parent]->route) && isset($items[$parent]->tree)) {
                 $parent_route = $items[$parent]->route . '/';
                 $parent_tree = $items[$parent]->tree;
             }
             //Create tree
             array_push($parent_tree, $item->id);
             $item->tree = $parent_tree;
             //Create route
             $route = $parent_route . $item->alias;
             $item->route = $route;
             //Create the query array
             $url = str_replace('index.php?', '', $item->link);
             if (strpos($url, '&amp;') !== false) {
                 $url = str_replace('&amp;', '&', $url);
             }
             //Set the item status
             $item->status = isset($nodes[$item->id]) ? $nodes[$item->id]->status : Nooku::STATUS_UNKNOWN;
             parse_str($url, $item->query);
         }
         $cache->store(serialize($items), 'items');
         $this->_items = $items;
     } else {
         $this->_items = unserialize($data);
     }
 }
Example #28
0
 public function validate()
 {
     $data = new ArrayObject();
     $data['alias'] = KInput::get('alias', 'post', 'string');
     $data['title'] = KInput::get('title', 'post', 'string');
     $data['id'] = KInput::get('id', 'post', 'int');
     $data['section'] = KInput::get('section', 'post', 'cmd');
     $component = KInput::get('component', 'get', 'cmd');
     $component = substr($component, 4);
     $handler = KFactory::get('admin::com.nooku.event.' . $component);
     if (!$handler->onValidateForm($data)) {
         //Add the message to the message queue
         $app = KFactory::get('lib.joomla.application');
         $app->enqueueMessage(JText::_($handler->getValidationMsg()));
         //Prepare the data array to push into the view
         $result = array();
         $result['alias'] = array('value' => $data['alias'], 'message' => KFactory::get('lib.koowa.document.html.renderer.message')->render('message'));
         $view = $this->getView('json')->assign($result)->display();
     }
 }
Example #29
0
 public function __construct($subject, $config = array())
 {
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'koowa' . DS . 'koowa.php';
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'koowa' . DS . 'loader.php';
     // Proxy the application object
     $app =& JFactory::getApplication();
     $app = new KProxyJoomlaApplication($app);
     // Don't proxy the dataase if we are in com_installer
     if (KInput::get('option', array('get', 'post'), 'cmd') != 'com_installer') {
         // Proxy the database object
         $db =& JFactory::getDBO();
         $db = new KDatabase($db);
         //ACL uses the unwrapped DBO
         $acl = JFactory::getACL();
         $acl->_db = $db->getObject();
         // getObject returns the unwrapped DBO
     }
     //Load the koowa plugins
     JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher'));
     parent::__construct($subject, $config = array());
 }
Example #30
0
 /**
  * Handle the onDisplay event for the button
  *
  * @return object A JObject containing the button settings
  */
 function onDisplay($name)
 {
     if (!KFactory::get('admin::com.nooku.model.permissions')->canTranslate() || KInput::get('option', array('post', 'get'), 'cmd') != 'com_content' || KInput::get('task', array('post', 'get'), 'cmd') != 'edit') {
         return new JObject();
     }
     KViewHelper::_('behavior.modal');
     $doc = KFactory::get('lib.joomla.document');
     $css = ' .button2-left .translate { ' . ' 	background:transparent url( ' . Nooku::getURL('media') . 'images/button_translate.png) no-repeat scroll 100% 0pt;' . ' } ';
     $doc->addStyleDeclaration($css);
     $cid = KInput::get('cid', array('post', 'get'), 'array.ints');
     $cid = (int) $cid[0];
     if ($cid === 0) {
         $cid = KInput::get('id', array('post', 'get'), 'string', 'int');
     }
     $button = new JObject();
     $button->set('modal', true);
     $button->set('link', 'index.php?option=com_nooku&amp;view=translate&amp;tmpl=component&amp;id=' . $cid . '&amp;editor=' . $name);
     $button->set('text', JText::_('Translate'));
     $button->set('name', 'translate');
     $button->set('options', "{handler: 'iframe', size: {x: 900, y: 600}}");
     return $button;
 }