Skip to content

Instantly share code, notes, and snippets.

@rsmarshall
rsmarshall / Supplier_model.php
Created May 14, 2012 16:06
what's going wrong
<?php
/**
* Supplier management library
* @package Suppliers
* @author Ryan Marshall <ryan@irealms.co.uk>
*/
class Suppliers_model extends BF_Model {
protected $table = 'bf_supplier_details';
protected $key = 'id';
@rsmarshall
rsmarshall / content.php
Created May 15, 2012 13:43
content.php
<?php
/**
* Content controller for supplier management
* @package Suppliers
* @author Ryan Marshall <ryan@irealms.co.uk>
*/
class Content extends Admin_Controller {
public function __construct()
{
@rsmarshall
rsmarshall / content.php
Created May 15, 2012 13:49
search method
public function search()
{
$data = array(
'search_string' => $this->input->get_post('search_string')
);
$this->form_validation->set_data($data);
$this->form_validation->set_rules('search_string', 'Search', 'required');
$results = NULL;
if ($this->form_validation->run($this) !== FALSE)
{
@rsmarshall
rsmarshall / content.php
Created May 16, 2012 09:18
search methods
<?php
// Controller method
public function search()
{
$results = NULL;
if ($this->input->get_post('search_string'))
{
$results = $this->suppliers_model->search($this->limit, $this->input->get('per_page'));
$this->pager['base_url'] = current_url() . '?search_string=' . $this->input->get_post('search_string');
<?php
class Migration_Mapping_tables extends Migration {
public function up()
{
$this->load->dbforge();
// Create stock feed mapping table
$this->dbforge->add_field('supplier_id TINYINT(2) UNSIGNED NOT NULL AUTO_INCREMENT');
$this->dbforge->add_field('sku TINYINT(2) NOT NULL');
$this->dbforge->add_field('supplier_code TINYINT(2) NOT NULL');
<?php
class Migration_Foreign_keys extends Migration {
public $migration_type = 'sql';
public function up()
{
$prefix = $this->db->dbprefix;
$sql = "
ALTER TABLE {$prefix}supplier_pricing
<?php
/**
* Supplier management library
* @package Suppliers
* @author Ryan Marshall <ryan@irealms.co.uk>
*/
class Suppliers_model extends BF_Model {
protected $table = 'supplier_details';
protected $key = 'id';
@rsmarshall
rsmarshall / content.php
Created May 21, 2012 14:45
form thingy
$fields = $this->db->list_fields('supplier_details');
$ignore_fields = array('id');
$use_fields = array_diff($fields, $ignore_fields);
$data = elements($use_fields, $this->input->post());
@rsmarshall
rsmarshall / boxfile
Created July 10, 2012 11:51
irealms boxfile
web1: #component type & number
name: irealms-pyrocms #component settings
shared_writable_dirs:
- /system/cms/cache/
- /system/cms/logs/
- /uploads/
php_extensions:
- mysql
- gd
- curl
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.