Skip to content

Instantly share code, notes, and snippets.

@snetty
snetty / blahblah_module.php
Last active December 14, 2015 09:19
improves the auto footprints class by adding a "last interaction" column
Backend::$events->addEvent('core:onBeforeListRecordDisplay', $this, 'extend_auto_footprints');
public function extend_auto_footprints($controller, $model_class, $model){
$controller->list_cell_individual_partial['last_interaction'] = 'modules/hosting/controllers/partials/last_interaction.htm';
}
@snetty
snetty / easy_string_search_functions.php
Created March 1, 2013 12:42
easy to remember string search functions
function contains($haystack, $needle){
return strpos($haystack, $needle) !== false;
}
function begins_with($haystack, $needle){
return strpos($haystack, $needle) === 0;
}
function ends_with($haystack, $needle){
return strlen($haystack) - strlen($needle) === strrpos($haystack,$needle);
$this->list_custom_body_cells = PATH_APP . '/modules/hosting/controllers/hosting_domains/_list_body_front_cells.htm';
$this->list_custom_head_cells = PATH_APP . '/modules/hosting/controllers/hosting_domains/_list_head_front_cells.htm';
$this->list_handle_row_click = false; #switches to double click
@snetty
snetty / php_datetime_default_format
Created February 6, 2013 11:37
Phpr_DateTime load default format
Phpr::$lang->date(Phpr_DateTime $date, '%F %X');
@snetty
snetty / gist:4721536
Created February 6, 2013 09:55
set default shipping and payment methods in lemonstand
public function extend_order_model($order){
if($order->is_new_record()){
$order->shipping_method = Shop_ShippingOption::create()->find_by_ls_api_code('no_shipping_required');
$order->payment_method = Shop_PaymentMethod::create()->find_by_ls_api_code('default');
}
}
@snetty
snetty / _form_field_checkboxlist.htm
Created January 16, 2013 13:12
add search to frm_checkboxlist's
<?
$dbName = $this->formGetFieldDbName($form_field->dbName, $this->viewData['form_model']);
$options = $this->formFieldGetOptions($form_field->dbName, $this->viewData['form_model']);
$list_search_prompt = isset($form_field->list_search_prompt) ? $form_field->list_search_prompt : 'Search ' . strtolower($dbName) . '...';
$list_load_indicator = isset($form_field->list_load_indicator) ? $form_field->list_load_indicator : 'phproad/resources/images/form_load_50x50.gif';
$container_id = $dbName.'_cb_container';
?>