Ejemplo n.º 1
0
 public function testConvertVagueDate_To_Unknown()
 {
     $vd = array(null, null, 'U');
     $s = vague_date::vague_date_to_string($vd);
     $this->assertEquals(kohana::lang('dates.unknown'), $s);
     $vd = array('', '', 'U');
     $s = vague_date::vague_date_to_string($vd);
     $this->assertEquals(kohana::lang('dates.unknown'), $s);
 }
Ejemplo n.º 2
0
 /**
  *  Setup the default values to use when loading this controller to edit a new page.   
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // survey id is passed as first argument in URL when creating. But the image
         // gets linked by meaning, so fetch the meaning_id.
         $r['survey:id'] = $this->uri->argument(1);
         $r['survey_medium:survey_id'] = $this->uri->argument(1);
         $r['survey_medium:caption'] = kohana::lang('misc.new_image');
     }
     return $r;
 }
Ejemplo n.º 3
0
 /**
  *  Setup the default values to use when loading this controller to create a new image.   
  */
 protected function getDefaults()
 {
     $r = parent::getDefaults();
     if ($this->uri->method(false) == 'create') {
         // taxa_taxon_list id is passed as first argument in URL when creating. But the image
         // gets linked by meaning, so fetch the meaning_id.
         $ttl = ORM::Factory('taxa_taxon_list', $this->uri->argument(1));
         $r['taxa_taxon_list:id'] = $this->uri->argument(1);
         $r['taxon_medium:taxon_meaning_id'] = $ttl->taxon_meaning_id;
         $r['taxon_medium:caption'] = kohana::lang('misc.new_image');
     }
     return $r;
 }
Ejemplo n.º 4
0
 public function active_user()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => kohana::lang('o_global.not_implemented'), 'content' => array());
     try {
         $user_id = $this->input->post('user_id');
         if (!$user_id) {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 403);
         }
         $user = Myuser::instance($user_id)->get();
         $data['register_mail_active'] = 1;
         $data['id'] = $user_id;
         if ($user = Myuser::instance($user_id)->edit($data)) {
             $return_struct = array('status' => 1, 'code' => 200, 'msg' => Kohana::lang('o_global.update_success'), 'content' => $user);
             exit(json_encode($return_struct));
         }
     } catch (MyRuntimeException $ex) {
         $return_struct = array('status' => 0, 'code' => 501, 'msg' => $ex->getMessage(), 'content' => array());
         if (request::is_ajax()) {
             exit(json_encode($return_struct));
         } else {
             remind::set($ex->getMessage(), 'user/user');
         }
     }
 }
Ejemplo n.º 5
0
?>
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<h2><?php 
echo Kohana::lang('page.edit_page');
?>
</h2>

<? base::errors($errors); ?>

<?
echo form::open(NULL, array('class' => 'glForms'));
echo form::label('heading', kohana::lang('page.heading'));
echo form::input('heading', ($form['heading']));
echo '<br />';
echo form::label('url', Kohana::lang('page.url'));
echo form::input('url', ($form['url']),'readonly="readonly"');
echo '<div class="cleaner">&nbsp;</div>';
echo '<br />';
echo form::label('page_text', Kohana::lang('page.text'));
echo form::textarea('page_text', ($form['page_text']), 'class="richEditor" cols="60" rows="20"');
echo '<br />';
echo form::label('display_menu', kohana::lang('page.display_menu'));
echo form::checkbox('display_menu', 1,($form['display_menu']));
echo '<br />';
echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('page.edit'),'class=button');
echo '<br />';
echo form::close();
?>
Ejemplo n.º 6
0
echo form::input('customer_phone', $form['customer_phone']);

echo form::close_fieldset();

echo form::open_fieldset();
echo form::legend(Kohana::lang('eshop.billing_info'));

echo form::label('billing_name', kohana::lang('eshop.name'));
echo form::input('billing_name', $form['billing_name']);
echo "<br />";
echo form::label('billing_street', kohana::lang('eshop.street'));
echo form::input('billing_street', $form['billing_street']);
echo "<br />";
echo form::label('billing_city', kohana::lang('eshop.city'));
echo form::input('billing_city', $form['billing_city']);
echo "<br />";
echo form::label('billing_postal_code', kohana::lang('eshop.postal_code'));
echo form::input('billing_postal_code', $form['billing_postal_code'],'size="8"');
echo "<br />";
echo form::label('billing_identity_number', kohana::lang('eshop.identity_number'));
echo form::input('billing_identity_number', $form['billing_identity_number'],'size="8"');
echo "<br />";
echo form::label('billing_vat_number', kohana::lang('eshop.vat_number'));
echo form::input('billing_vat_number', $form['billing_vat_number'],'size="12"');
echo form::close_fieldset();

echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('eshop.update'),'class=button');
echo '<br />';
echo form::close();
?>
Ejemplo n.º 7
0
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<h3><?php 
echo Kohana::lang('eshop.customer_detail');
?>
</h3>

<h4><? echo (Kohana::lang('eshop.personal_info')); ?></h4>

<p><? echo Kohana::lang('eshop.name'); ?>: <strong><? echo $row['name']; ?></strong></p>
<p><? echo Kohana::lang('eshop.email'); ?>: <strong><? echo $row['email']; ?></strong></p>

<p><? echo Kohana::lang('eshop.street'); ?>: <strong><br /><? echo $row['customer_street']; ?><br />
<? echo $row['customer_city']; ?><br />
<? echo $row['customer_postal_code']; ?></strong></p>
<p><? echo kohana::lang('eshop.phone'); ?>: <strong><? echo $row['customer_phone']; ?></strong></p>

<h4><? echo Kohana::lang('eshop.billing_info'); ?></h4>

<p><? echo kohana::lang('eshop.name'); ?>: <strong><? echo $row['billing_name']; ?></strong></p>
<p><? echo Kohana::lang('eshop.street'); ?>: <strong><br /><? echo $row['billing_street']; ?><br />
<? echo $row['billing_city']; ?><br />
<? echo $row['billing_postal_code']; ?></strong></p>
<p><? echo kohana::lang('eshop.identity_number'); ?>: <strong><? echo $row['billing_identity_number']; ?></strong></p>
<p><? echo kohana::lang('eshop.vat_number'); ?>: <strong><? echo $row['billing_vat_number']; ?></strong></p>

<h4><? echo Kohana::lang('eshop.other'); ?></h4>

<p><? echo kohana::lang('eshop.number_orders'); ?>: <strong><? echo $num_orders; ?></strong></p>
Ejemplo n.º 8
0
<? 
/**
 *@package Eshop
 **/
?>
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<h2><?php 
echo Kohana::lang('eshop.add_cat');
?>
</h2>

<? base::errors($errors); ?>

<?
echo form::open(NULL, array('class' => 'glForms'));
echo form::label('name', kohana::lang('eshop.name'));
echo form::input('name', ($form['name']));
echo '<div class="cleaner">&nbsp;</div>';
echo form::label('parent', Kohana::lang('eshop.parent_cat'));
echo form::dropdown('parent',$selection,$form['parent']);
echo '<br />';
echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('eshop.add'),'class=button');
echo '<br />';
echo form::close();
?>
Ejemplo n.º 9
0
 *@package Search
 **/
?>
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<h2><?php 
echo Kohana::lang('search.search');
?>
</h2>

<? base::errors($errors); ?>

<?
echo form::open(NULL, array('class' => 'glForms'));
echo form::label('value', kohana::lang('search.value'));
echo form::input('value', ($form['value']));
echo '<br />';
echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('search.go'),'class=button');
echo '<br />';
echo form::close();
?>
<div class="cleaner">&nbsp;</div>
<hr />

<? // Rendering products results ?>
<h2><?php 
echo Kohana::lang('search.results_for_products');
?>
</h2>
Ejemplo n.º 10
0
 /**
  * When a field is present in the model that is an fkField, this means it contains a lookup
  * caption that must be searched for in the fk entity. This method does the searching and
  * puts the fk id back into the main model so when it is saved, it links to the correct fk
  * record.
  * Respects the setting $cacheFkLookups to use the cache if possible.
  *
  * @return boolean True if all lookups populated successfully.
  */
 private function populateFkLookups()
 {
     $r = true;
     if (array_key_exists('fkFields', $this->submission)) {
         foreach ($this->submission['fkFields'] as $a => $b) {
             if (!empty($b['fkSearchValue'])) {
                 // if doing a parent lookup in a list based entity (terms or taxa), then filter to lookup within the list.
                 if (isset($this->list_id_field) && $b['fkIdField'] === 'parent_id' && !isset($b['fkSearchFilterField'])) {
                     $b['fkSearchFilterField'] = $this->list_id_field;
                     $b['fkSearchFilterValue'] = $this->submission['fields'][$this->list_id_field]['value'];
                 }
                 $fk = $this->fkLookup($b);
                 if ($fk) {
                     $this->submission['fields'][$b['fkIdField']] = array('value' => $fk);
                 } else {
                     // look for a translation of the field name
                     $lookingIn = kohana::lang("default.dd:{$this->object_name}:{$a}");
                     if ($lookingIn === "default.dd:{$this->object_name}:{$a}") {
                         $fields = $this->getSubmittableFields(FALSE);
                         $lookingIn = empty($fields[$this->object_name . ':' . $a]) ? $b['readableTableName'] . ' ' . ucwords($b['fkSearchField']) : $fields[$this->object_name . ':' . $a];
                     }
                     $this->errors[$a] = "Could not find \"{$b['fkSearchValue']}\" in {$lookingIn}";
                     $r = false;
                 }
             }
         }
     }
     return $r;
 }
Ejemplo n.º 11
0
echo data_entry_helper::text_input(array('label' => 'Name', 'fieldname' => 'trigger:name', 'default' => html::initial_value($values, 'trigger:name'), 'class' => 'control-width-5'));
echo data_entry_helper::textarea(array('label' => 'Description', 'fieldname' => 'trigger:description', 'default' => html::initial_value($values, 'trigger:description')));
echo data_entry_helper::select(array('label' => 'Trigger template', 'fieldname' => 'trigger:trigger_template_file', 'default' => html::initial_value($values, 'trigger:trigger_template_file'), 'lookupValues' => $other_data['triggerFileList']));
echo data_entry_helper::checkbox(array('label' => 'Public', 'fieldname' => 'trigger:public', 'default' => html::initial_value($values, 'trigger:public')));
data_entry_helper::link_default_stylesheet();
// No need to re-link to jQuery
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
echo data_entry_helper::dump_javascript();
?>
</fieldset>
<fieldset class="button-set">
<input type="submit" name="submit" value="<?php 
echo kohana::lang('misc.next');
?>
" class="ui-corner-all ui-state-default button ui-priority-primary" />
<input type="submit" name="submit" value="<?php 
echo kohana::lang('misc.cancel');
?>
" class="ui-corner-all ui-state-default button" />
<input type="submit" name="submit" value="<?php 
echo kohana::lang('misc.delete');
?>
" onclick="if (!confirm('<?php 
echo kohana::lang('misc.confirm_delete');
?>
')) {return false;}" class="ui-corner-all ui-state-default button" />
</fieldset>
</form>
Ejemplo n.º 12
0
 /** 
  * Return HTML to output the default OK and Cancel buttons to display at the bottom of an edit form. Also
  * outputs a delete button if the $allowDelete parameter is true.
  * 
  * @param boolean $allowDelete If true, then a delete button is included in the output.
  * @param boolean $readOnly If true, then the only button is a form cancel button.
  * @param boolean $allowUserSelectNextPage If true then then a select control is output which lets the user define
  * whether to continue adding records on the add new page or to return the index page for the current model.
  */
 public static function form_buttons($allowDelete, $readOnly = false, $allowUserSelectNextPage = true)
 {
     $r = '<fieldset class="button-set">' . "\n";
     if ($readOnly) {
         $r .= '<input type="submit" name="submit" value="' . kohana::lang('misc.cancel') . '" class="ui-corner-all ui-state-default button" />' . "\n";
     } else {
         $r .= '<input type="submit" name="submit" value="' . kohana::lang('misc.save') . '" class="ui-corner-all ui-state-default button ui-priority-primary" />' . "\n";
         $r .= '<input type="submit" name="submit" value="' . kohana::lang('misc.cancel') . '" class="ui-corner-all ui-state-default button" />' . "\n";
         if ($allowDelete) {
             $r .= '<input type="submit" name="submit" value="' . kohana::lang('misc.delete') . '" onclick="if (!confirm(\'' . kohana::lang('misc.confirm_delete') . '\')) {return false;}" class="ui-corner-all ui-state-default button" />' . "\n";
         }
         // add a drop down to select action after submit clicked. Needs to remember its previous setting from the session,
         // since we normally arrive here after a redirect.
         if (isset($_SESSION['what-next']) && $_SESSION['what-next'] == 'add') {
             $selAdd = ' selected="selected"';
             $selReturn = '';
         } else {
             $selAdd = '';
             $selReturn = ' selected="selected"';
         }
         if ($allowUserSelectNextPage) {
             $r .= '<label for="next-action">' . kohana::lang('misc.then') . '</label>';
             $r .= '<select id="what-next" name="what-next"><option value="return"' . $selReturn . '>go back to the list</option><option value="add"' . $selAdd . '>add new</option></select>';
         }
     }
     $r .= '</fieldset>';
     return $r;
 }
Ejemplo n.º 13
0
 /**
  * If this occurrence record status was reset after an edit, then log a comment.
  */
 public function postSubmit($isInsert)
 {
     if ($this->requeuedForVerification && !$isInsert) {
         $data = array('occurrence_id' => $this->id, 'comment' => kohana::lang('misc.recheck_verification'), 'auto_generated' => 't');
         $comment = ORM::factory('occurrence_comment');
         $comment->validate(new Validation($data), true);
     }
     return true;
 }
Ejemplo n.º 14
0
<p><? echo kohana::lang('eshop.vat_number'); ?>: <strong><? echo $profile['billing_vat_number']; ?></strong></p>
<? echo form::close_fieldset();
echo '<br />';
echo form::open_fieldset();
echo form::legend(Kohana::lang('eshop.delivery_info'));

echo form::label('delivery_name', kohana::lang('eshop.name'));
echo form::input('delivery_name', $form['delivery_name']);
echo "<br />";
echo form::label('delivery_street', kohana::lang('eshop.street'));
echo form::input('delivery_street', $form['delivery_street']);
echo "<br />";
echo form::label('delivery_city', kohana::lang('eshop.city'));
echo form::input('delivery_city', $form['delivery_city']);
echo "<br />";
echo form::label('delivery_postal_code', kohana::lang('eshop.postal_code'));
echo form::input('delivery_postal_code', $form['delivery_postal_code'],'size="8"');
echo form::close_fieldset();

echo form::open_fieldset();
echo form::legend(Kohana::lang('eshop.payment'));
foreach($payment_methods as $row){
	echo form::label('payment',$row['name']);
	if($form['payment'] == $row['id']){
		echo form::radio('payment',$row['id'],TRUE);
	} else {
		echo form::radio('payment',$row['id'],FALSE);
	}
	echo '<br />';
}
echo form::close_fieldset();
Ejemplo n.º 15
0
echo Kohana::lang('user.settings');
?>
</h2>
<p><?php 
echo Kohana::lang('user.settings_text');
?>
</p>

<? base::success($success); ?>
<? base::errors($errors); ?>

<?
echo form::open(NULL, array('class' => 'glForms'));
echo form::open_fieldset();
echo form::legend(Kohana::lang('user.changedata'));
echo form::label('fullname', kohana::lang('user.yourname'));
echo form::input('fullname', ($form['fullname']));
echo '<br />';
echo form::close_fieldset();
echo form::open_fieldset();
echo form::legend(Kohana::lang('user.changepassword'));
echo form::label('password3', Kohana::lang('user.password3'));
echo form::password('password3', $form['password3']);
echo '<br />';
echo form::label('password2', Kohana::lang('user.password2'));
echo form::password('password2', $form['password2']);
echo '<br />';
echo form::label('password', Kohana::lang('user.password'));
echo form::password('password', $form['password']);
echo form::close_fieldset();
echo form::label('submit', '&nbsp;');
Ejemplo n.º 16
0
echo '<div class="cleaner">&nbsp;</div>';
echo form::label('cat[]', Kohana::lang('eshop.parent_cat'));
echo form::dropdown(array('name' => 'cat[]', 'multiple' => 'multiple', 'size' => 5),$selection,$form['cat']);
echo '<div class="cleaner">&nbsp;</div>';
echo form::label('manufacturer', Kohana::lang('eshop.manufacturer'));
echo form::dropdown('manufacturer',$selection2,$form['manufacturer']);
echo '<br />';
echo form::label('short_description', Kohana::lang('eshop.short_description'));
echo form::textarea('short_description', ($form['short_description']), 'class="poorEditor" cols="60" rows="10"');
echo '<div class="cleaner">&nbsp;</div>';
echo '<br />';
echo form::label('description', Kohana::lang('eshop.description'));
echo form::textarea('description', ($form['description']), 'class="richEditor" cols="60" rows="20"');
echo '<br />';
echo form::label('price', kohana::lang('eshop.price'));
echo form::input('price', ($form['price']));
echo '<br />';
echo form::label('a_tip', kohana::lang('eshop.tip'));
echo form::checkbox('tip', 1,$form['tip']);
echo '<br />';
echo form::label('a_news', kohana::lang('eshop.news'));
echo form::checkbox('news', 1,($form['news']));
echo '<br />';
echo form::label('a_discount', kohana::lang('eshop.discount'));
echo form::checkbox('discount', 1,($form['discount']));
echo '<br />';
echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('eshop.add'),'class=button');
echo '<br />';
echo form::close();
?>
Ejemplo n.º 17
0
/**
 *@package User
 **/
?>
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<h2><?php 
echo Kohana::lang('user.renew_password');
?>
</h2>

<p><?php 
echo Kohana::lang('user.renew_briefing');
?>
</p>

<? base::errors($errors); ?>

<?
echo form::open(NULL, array('class' => 'glForms'));
echo form::label('email', kohana::lang('user.email'));
echo form::input('email', ($form['email']));
echo '<br />';
echo form::label('code', kohana::lang('user.code'));
echo form::input('code', ($form['code']),'size="28"');
echo '<br />';
echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('user.sendpassword'),'class=button');
echo '<br />';
echo form::close();?>
Ejemplo n.º 18
0
 /**
  * Method to handle the upgrade from 0.2.3 to 0.2.4.
  * This needs to clean up the old upgrade 0_1_to_0_2 folder plus move the last upgrade script
  * marker into the new version 0_2_3 folder. 
  */
 private function version_0_2_3()
 {
     // Only bother if the old script upgrade folder still exists.
     if (file_exists($this->base_dir . '/modules/indicia_setup/db/upgrade_0_1_to_0_2/')) {
         $last_executed_marker_file = $this->get_last_executed_sql_file_name($this->base_dir . '/modules/indicia_setup/db/upgrade_0_1_to_0_2/');
         if ($last_executed_marker_file) {
             if (false === @file_put_contents($this->base_dir . '/modules/indicia_setup/db/version_0_2_3/' . basename($last_executed_marker_file), 'nop')) {
                 throw new Exception("Couldn't write last executed file name: " . $full_upgrade_folder . '/____' . str_replace(".sql", "", $prev) . '____');
             }
         }
         // remove the old database upgrade folder
         try {
             $this->deltree($this->base_dir . '/modules/indicia_setup/db/upgrade_0_1_to_0_2/');
         } catch (Exception $e) {
             $session = new Session();
             $session->set_flash('flash_error', kohana::lang('setup.failed_delete_old_upgrade_folder'));
         }
     }
 }
Ejemplo n.º 19
0
 /**
  * Look for records posted by recorders who have given their email address and want to receive a summary of the record they are posting.
  */
 private function doRecordOwnerNotifications($swift)
 {
     // Get a list of the records which contributors want to get a summary back for
     $emailsRequired = $this->db->select('DISTINCT occurrences.id as occurrence_id, sav2.text_value as email_address, surveys.title as survey')->from('occurrences')->join('samples', 'samples.id', 'occurrences.sample_id')->join('surveys', 'surveys.id', 'samples.survey_id')->join('sample_attribute_values as sav1', 'sav1.sample_id', 'samples.id')->join('sample_attributes as sa1', 'sa1.id', 'sav1.sample_attribute_id')->join('sample_attribute_values as sav2', 'sav2.sample_id', 'samples.id')->join('sample_attributes as sa2', 'sa2.id', 'sav2.sample_attribute_id')->where(array('sa1.caption' => 'Email me a copy of the record', 'sa2.caption' => 'Email', 'samples.created_on>=' => $this->last_run_date))->get();
     // get a list of the records we need details of, so we can hit the db more efficiently.
     $recordsToFetch = array();
     foreach ($emailsRequired as $email) {
         $recordsToFetch[] = $email->occurrence_id;
     }
     $occurrences = $this->db->select('o.id, ttl.taxon, s.date_start, s.date_end, s.date_type, s.entered_sref as spatial_reference, ' . 's.location_name, o.comment as sample_comment, o.comment as occurrence_comment')->from('samples as s')->join('occurrences as o', 'o.sample_id', 's.id')->join('list_taxa_taxon_lists as ttl', 'ttl.id', 'o.taxa_taxon_list_id')->in('o.id', $recordsToFetch)->get();
     // Copy the occurrences to an array so we can build a structured list of data, keyed by ID
     $occurrenceArray = array();
     foreach ($occurrences as $occurrence) {
         $occurrenceArray[$occurrence->id] = $occurrence;
     }
     $attrArray = array();
     // Get the sample attributes
     $attrValues = $this->db->select('o.id, av.caption, av.value')->from('list_sample_attribute_values as av')->join('samples as s', 's.id', 'av.sample_id')->join('occurrences as o', 'o.sample_id', 's.id')->in('o.id', $recordsToFetch)->get();
     foreach ($attrValues as $attrValue) {
         $attrArray[$attrValue->id][$attrValue->caption] = $attrValue->value;
     }
     // Get the occurrence attributes
     $attrValues = $this->db->select('av.occurrence_id, av.caption, av.value')->from('list_occurrence_attribute_values av')->in('av.occurrence_id', $recordsToFetch)->get();
     foreach ($attrValues as $attrValue) {
         $attrArray[$attrValue->occurrence_id][$attrValue->caption] = $attrValue->value;
     }
     $email_config = Kohana::config('email');
     foreach ($emailsRequired as $email) {
         $emailContent = 'Thank you for sending your record to ' . $email->survey . '. Here are the details of your contribution for your records.<br/><table>';
         $this->addArrayToEmailTable($email->occurrence_id, $occurrenceArray, $emailContent);
         $this->addArrayToEmailTable($email->occurrence_id, $attrArray, $emailContent);
         $emailContent .= "</table>";
         $message = new Swift_Message(kohana::lang('misc.notification_subject', kohana::config('email.server_name')), $emailContent, 'text/html');
         $recipients = new Swift_RecipientList();
         $recipients->addTo($email->email_address);
         // send the email
         $swift->send($message, $recipients, $email_config['address']);
     }
 }
Ejemplo n.º 20
0
 **/
?>
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<h2><?php 
echo Kohana::lang('news.add_news');
?>
</h2>

<?php 
echo base::errors($errors);
?>

<?
echo form::open(NULL, array('class' => 'glForms'));
echo form::label('heading', kohana::lang('news.heading'));
echo form::input('heading', ($form['heading']));
echo '<div class="cleaner">&nbsp;</div>';
echo '<br />';
echo form::label('perex', Kohana::lang('news.perex'));
echo form::textarea('perex', ($form['perex']), 'class="poorEditor" cols="60" rows="20"');
echo '<br />';
echo form::label('news_text', Kohana::lang('news.text'));
echo form::textarea('news_text', ($form['news_text']), 'class="richEditor" cols="60" rows="20"');
echo '<br />';
echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('news.add'),'class=button');
echo '<br />';
echo form::close();
?>
Ejemplo n.º 21
0
 /**
  * Provides a wrapper for dynamic calls to a spatial reference module's
  * spatial_ref_to_wkt method (produces well known text from an sref).
  *
  * @return string Well Known Text for the point or polygon described by the sref, in
  * the WGS84 datum.
  */
 public static function sref_to_internal_wkt($sref, $sref_system)
 {
     $system = strtolower($sref_system);
     $sref = strtoupper($sref);
     if (is_numeric($system)) {
         // EPSG code
         // first check if this $system expects Lat/Long format, rather than x,y
         if (array_key_exists($system, kohana::config('sref_notations.lat_long_systems'))) {
             $wkt = self::lat_long_to_wkt($sref);
         } else {
             // else this is just a pair of numbers with a list separator
             $coords = explode(kohana::lang('misc.x_y_separator'), $sref);
             $wkt = 'POINT(' . $coords[0] . ' ' . $coords[1] . ')';
         }
         $srid = $system;
     } else {
         self::validateSystemClass($system);
         $wkt = call_user_func("{$system}::sref_to_wkt", $sref);
         $systems = self::system_metadata();
         $srid = $systems[$system]['srid'];
     }
     return self::wkt_to_internal_wkt($wkt, $srid);
 }
Ejemplo n.º 22
0
 /** 
  * Controller function to display a generic import wizard for any data.
  */
 public function importer()
 {
     $this->SetView('importer', '', array('model' => $this->controllerpath));
     $this->template->title = $this->pagetitle . ' Import';
     // Setup a breadcrumb as if we are in the edit page since this will give us the correct links upwards
     $this->defineEditBreadcrumbs();
     // but make it clear the bottom level breadcrumb is the importer
     $this->page_breadcrumbs[count($this->page_breadcrumbs) - 1] = kohana::lang('misc.model_import', $this->model->caption());
 }
Ejemplo n.º 23
0
defined('SYSPATH') or die('No direct access allowed.');
?>
<? foreach ($data as $row) { ?>
	<div class="news">
		<h3><? echo $row['heading']; ?></h3>
		<?php 
if (file_exists('/image/news/' . $row['id'])) {
    ?>
			<a href="/news/detail/<?php 
    echo $row['id'];
    ?>
"><img src="/data/news/<?php 
    echo $row['id'];
    ?>
_m.jpg" alt="<?php 
    kohana::lang('news.image_for');
    ?>
 <?php 
    echo $row['heading'];
    ?>
" /></a>
		<?php 
}
?>
		<?php 
echo $row['perex'];
?>
		<a href="/news/detail/<?php 
echo $row['id'];
?>
"><?php 
" />
<input type="hidden" name="trigger_action:type" value="E" />
<input type="hidden" name="trigger_action:param1" value="<?php 
echo html::initial_value($values, 'trigger_action:param1');
?>
" />
<input type="hidden" name="return_url" value="<?php 
echo url::site();
?>
trigger" />
<?php 
echo data_entry_helper::radio_group(array('fieldname' => 'trigger_action:param2', 'label' => 'Notification frequency', 'labelClass' => 'align-top', 'class' => 'check-or-radio-box', 'default' => html::initial_value($values, 'trigger_action:param2'), 'helpText' => 'Please specify how frequently you would like to receive email notifications for this trigger?', 'lookupValues' => array('N' => 'No emails', 'I' => 'Immediate', 'D' => 'Daily', 'W' => 'Weekly'), 'sep' => '<br/>'));
echo data_entry_helper::textarea(array('label' => 'Copy email to', 'helpText' => 'Provide a comma separated list of email addresses to copy this notification to.', 'labelClass' => 'align-top', 'fieldname' => 'trigger_action:param3', 'default' => html::initial_value($values, 'trigger_action:param3')));
?>
</fieldset>
<input type="submit" name="submit" value="<?php 
echo kohana::lang('misc.save');
?>
" class="ui-corner-all ui-state-default button ui-priority-primary" />
<input type="submit" name="submit" value="<?php 
echo kohana::lang('misc.cancel');
?>
" class="ui-corner-all ui-state-default button" />
<input type="submit" name="submit" value="<?php 
echo kohana::lang('misc.unsubscribe');
?>
" onclick="if (!confirm('<?php 
echo kohana::lang('misc.confirm_unsubscribe');
?>
')) {return false;}" class="ui-corner-all ui-state-default button" />
</form>
Ejemplo n.º 25
0
 public function show_toggle()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //权限验证
         if (!role::verify('user_attribute', $this->site_id, 0)) {
             $return_struct['msg'] = Kohana::lang('o_global.permission_enough');
             exit(json_encode($return_struct));
         }
         //收集信息
         $request_data = $this->input->get();
         if (empty($request_data) || !isset($request_data['attribute_id'])) {
             if ($this->is_ajax_request()) {
                 $return_struct['msg'] = kohana::lang('o_user_attribute.data_lost');
                 $return_struct['code'] = 400;
                 exit(json_encode($return_struct));
             } else {
                 throw new MyRuntimeException(kohana::lang('o_user_attribute.data_lost'), 400);
             }
         }
         //调用底层Service
         $user_attribute_service = User_attributeService::get_instance();
         $user_attribute = $user_attribute_service->get($request_data['attribute_id']);
         if (empty($user_attribute)) {
             if ($this->is_ajax_request()) {
                 $return_struct['msg'] = kohana::lang('o_user_attribute.user_attribute_not_exist');
                 $return_struct['code'] = 400;
                 exit(json_encode($return_struct));
             } else {
                 throw new MyRuntimeException(kohana::lang('o_user_attribute.user_attribute_not_exist'), 400);
             }
         }
         $arrtibute_show = array('attribute_show' => 1 - $user_attribute['attribute_show']);
         $user_attribute_service->set($user_attribute['id'], $arrtibute_show);
         //* 补充&修改返回结构体 */
         $return_struct['status'] = 1;
         $return_struct['code'] = 200;
         $return_struct['msg'] = kohana::lang('o_user_attribute.operator_success');
         $return_struct['content'] = $arrtibute_show;
         //* 请求类型 */
         if ($this->is_ajax_request()) {
             // ajax 请求
             // json 输出
             exit(json_encode($return_struct));
         } else {
             // html 输出
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $return_struct['status'] = 0;
         $return_struct['code'] = $ex->getCode();
         $return_struct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->is_ajax_request()) {
             $this->template->content = $return_struct;
         } else {
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
     }
 }
Ejemplo n.º 26
0
echo form::legend(Kohana::lang('eshop.other')); ?>
<p><? echo kohana::lang('eshop.status_order'); ?>: <strong><? echo customer::order_status($data['status_order'])?></strong></p>
<p><? echo kohana::lang('eshop.payment'); ?>: <strong><? echo payment::get_name($data['payment']); ?> &ndash; <? echo customer::payment_status($data['status_payment'])?></strong>

<? if($data['status_payment'] == 'none' AND payment::get_type($data['payment']) == "post"){ ?>
	&ndash; <a href="/cart/payment/<? echo $data['id']; ?>"><? echo Kohana::lang('eshop.payment_info'); ?></a>
<? } ?>
<? if($data['status_payment'] == 'none' AND payment::get_type($data['payment']) == "pre"){ ?>
	&ndash; <a href="/cart/payment/<? echo $data['id']; ?>"><? echo Kohana::lang('eshop.pay_now'); ?></a>
<? } ?>
</p>
<? if(payment::get_type($data['payment']) == "post"){ ?>
	<p><? echo Kohana::lang('eshop.vsymbol2'); ?>: <? echo $data['id']; ?></p>
<? } ?>
<p><? echo kohana::lang('eshop.shipping'); ?>: <strong><? echo shipping::get_name($data['shipping']); ?></strong></p>
<p><? echo kohana::lang('eshop.last_change'); ?>: <strong><? echo $data['last_change']; ?></strong></p>
<? echo form::close_fieldset(); ?>

<? echo form::close();?>

<h4><?php 
echo Kohana::lang('eshop.ordered');
?>
</h4>

<table class="cart">
	<tr><th><?php 
echo Kohana::lang('eshop.item');
?>
</th><th><?php 
echo Kohana::lang('eshop.quantity');
Ejemplo n.º 27
0
 /**
  * Handler for the Save action on all controllers. Saves the post array by 
  * passing it into the model and then submitting it. If the post array was 
  * sent by a submit button with value Delete, then the record is marked for 
  * deletion. 
  */
 public function save()
 {
     if (!$this->page_authorised()) {
         $this->session->set_flash('flash_error', "You appear to be attempting to edit a page you do not have rights to.");
         $this->redirectToIndex();
     } elseif ($_POST['submit'] == 'Cancel') {
         $this->redirectToIndex();
     } else {
         // Are we editing an existing record? If so, load it.
         if (array_key_exists('id', $_POST)) {
             $this->model = ORM::factory($this->model->object_name, $_POST['id']);
         } else {
             $this->model = ORM::factory($this->model->object_name);
         }
         // Were we instructed to delete the post?
         $deletion = $_POST['submit'] == kohana::lang('misc.delete') || $_POST['submit'] == kohana::lang('misc.unsubscribe');
         $_POST['deleted'] = $deletion ? 't' : 'f';
         // Pass the post object to the model and then submit it
         $this->model->set_submission_data($_POST);
         $this->submit($deletion);
     }
 }
Ejemplo n.º 28
0
    formatItem: function(item) {
      return item.taxon;
    },
    formatResult: function(item) {
      return item.id;
    }
  });
  $("input#taxon").result(function(event, data){
    $("input#taxa_taxon_list_id").attr('value', data.id);
  });
  jQuery('.vague-date-picker').datepicker({dateFormat : '<?php 
echo kohana::lang('dates.format_js');
?>
', constrainInput: false});    
  jQuery('.date-picker').datepicker({dateFormat : '<?php 
echo kohana::lang('dates.format_js');
?>
', constrainInput: false});
});
</script>
<form class="cmxform" action="<?php 
echo url::site() . 'occurrence/save';
?>
" method="post">
<?php 
echo $metadata;
?>
<fieldset class="readonly">
<legend>Sample summary</legend>
<ol>
<li>
Ejemplo n.º 29
0
 **/
?>
<?php 
defined('SYSPATH') or die('No direct access allowed.');
?>
<h2><?php 
echo Kohana::lang('user.login');
?>
</h2>

<? base::success($success); ?>
<? base::errors($errors); ?>

<?
echo form::open(NULL, array('class' => 'glForms'));
echo form::label('email', kohana::lang('user.email'));
echo form::input('email', ($form['email']));
echo '<br />';
echo form::label('password', Kohana::lang('user.password'));
echo form::password('password', NULL);
echo '<br />';
echo form::label('submit', '&nbsp;');
echo form::submit('submit', Kohana::lang('user.logmein'),'class=button');
echo '<br />';
echo form::close();
?>
<p><a href="/user/register"><?php 
echo Kohana::lang('user.register');
?>
</a> | <a href="/user/password"><?php 
echo Kohana::lang('user.forgot_password');
Ejemplo n.º 30
0
 /**
  * Post submit, use the sample's group.private_records to set the occurrence release status.
  * Also, if this was a verified sample but it has been modified, add a comment to explain
  * why its been requeued for verification.
  */
 public function postSubmit($isInsert)
 {
     if ($this->group_id) {
         $group = $this->db->select('id')->from('groups')->where(array('id' => $this->group_id, 'private_records' => 't', 'deleted' => 'f'))->get()->result_array();
         if (count($group)) {
             // This sample is associated with a group that does not release its records. So ensure the release_status flag
             // is set.
             $this->db->update('occurrences', array('release_status' => 'U'), array('sample_id' => $this->id, 'release_status' => 'R'));
             $this->db->update('cache_occurrences', array('release_status' => 'U'), array('sample_id' => $this->id, 'release_status' => 'R'));
         }
     }
     if ($this->requeuedForVerification && !$isInsert) {
         $data = array('sample_id' => $this->id, 'comment' => kohana::lang('misc.recheck_verification'), 'auto_generated' => 't');
         $comment = ORM::factory('sample_id');
         $comment->validate(new Validation($data), true);
     }
     return true;
 }