Location: PHPKode > projects > Mac's MVC Framework > Application/plugins/CMS/models/Roles_Model.php
<?php
/**
 * Roles Table Model
 *
 * @author Macdonald Robinson
 */

class Roles_Model extends CMS_Model
{
    public function __construct()
    {
      parent::__construct();
    }

    public function getCMSTableNameRoles()
    {
      return $this->getCMSTableName('Roles');
    }

    public function getAllRoles()
    {
      return $this->select( $this->getCMSTableNameRoles() );
    }

    public function getRoleByID($roleId)
    {
      return $this->selectSingle( $this->getCMSTableNameRoles(), array('ID'=>$roleId));
    }

    public function getRoleByName($name)
    {
      return $this->selectSingle( $this->getCMSTableNameRoles(), array('Name'=>$name));
    }

    public function insertRole($name, $description)
    {
      return $this->insert( $this->getCMSTableNameRoles(), array('Name'=>$name, 'Description'=>$description, 'CreatedOn'=>time(), 'LastModifiedOn'=>time() ));
    }

    public function updateRole($role, $name, $description)
    {
      return $this->update( $this->getCMSTableNameRoles(), array('Name'=>$name, 'Description'=>$description, 'LastModifiedOn'=>time()),  array('ID'=>$role->ID));
    }

    public function deleteRoleByID($roleId)
    {
      return $this->delete( $this->getCMSTableNameRoles(), array('ID'=>$roleId));
    }
}
?>
Return current item: Mac's MVC Framework