Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PORT THE FUNCTIONALITY 'CREATE/EDIT/DELETE USER GROUPS' TO THE YII PH…
…P FRAMEWORK : Done by GCI participant Ivan Penchev git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11563 b72ed6b6-b9f8-46b5-92b4-906544132732
- Loading branch information
1 parent
dc6f97d
commit 9ca2973
Showing
9 changed files
with
502 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<?php if ( ! defined('BASEPATH')) die('No direct script access allowed'); | ||
|
||
class User_groups extends CActiveRecord { | ||
|
||
protected $connection; | ||
|
||
/** | ||
* Returns the static model of Settings table | ||
* | ||
* @static | ||
* @access public | ||
* @return CActiveRecord | ||
*/ | ||
public static function model() | ||
{ | ||
return parent::model(__CLASS__); | ||
} | ||
|
||
/** | ||
* Returns the setting's table name to be used by the model | ||
* | ||
* @access public | ||
* @return string | ||
*/ | ||
public function tableName() | ||
{ | ||
return '{{user_groups}}'; | ||
} | ||
|
||
/** | ||
* Returns the primary key of this table | ||
* | ||
* @access public | ||
* @return string | ||
*/ | ||
public function primaryKey() | ||
{ | ||
return 'ugid'; | ||
} | ||
|
||
function getAllRecords($condition=FALSE) | ||
{ | ||
$this->connection = Yii::app()->db; | ||
if ($condition != FALSE) | ||
{ | ||
$where_clause = array("WHERE"); | ||
|
||
foreach($condition as $key=>$val) | ||
{ | ||
$where_clause[] = $key.'=\''.$val.'\''; | ||
} | ||
|
||
$where_string = implode(' AND ', $where_clause); | ||
} | ||
|
||
$query = 'SELECT * FROM '.$this->tableName().' '.$where_string; | ||
|
||
$data = createCommand($query)->query()->resultAll(); | ||
|
||
return $data; | ||
} | ||
|
||
function getSomeRecords($fields,$condition=FALSE, $params=NULL) | ||
{ | ||
$filter = new CDbCriteria; | ||
|
||
foreach ($fields as $field) | ||
{ | ||
$filter->select[] = $field; | ||
} | ||
|
||
if ($condition != FALSE) | ||
{ | ||
$filter->condition = $condition; | ||
$filter->params = $params; | ||
} | ||
|
||
$data = $this->findAll($filter); | ||
|
||
return $data; | ||
} | ||
|
||
/*function insertRecords($data) | ||
{ | ||
return $this->db->insert('user_groups',$data); | ||
} | ||
function join($fields, $from, $condition=FALSE, $join=FALSE, $order=FALSE) | ||
{ | ||
foreach ($fields as $field) | ||
{ | ||
$this->db->select($field); | ||
} | ||
$this->db->from($from); | ||
if ($condition != FALSE) | ||
{ | ||
$this->db->where($condition); | ||
} | ||
if ($order != FALSE) | ||
{ | ||
$this->db->order_by($order); | ||
} | ||
if (isset($join['where'], $join['type'], $join['on'])) | ||
{ | ||
$this->db->join($condition); | ||
} | ||
$data = $this->db->get(); | ||
return $data; | ||
} | ||
function multi_select($fields, $from, $condition=FALSE) | ||
{ | ||
foreach ($fields as $field) | ||
{ | ||
$this->db->select($field); | ||
} | ||
foreach ($from AS $f) | ||
{ | ||
$this->db->from($f); | ||
} | ||
if ($condition != FALSE) | ||
{ | ||
$this->db->where($condition); | ||
} | ||
if ($order != FALSE) | ||
{ | ||
$this->db->order_by($order); | ||
} | ||
if (isset($join['where'], $join['type'], $join['on'])) | ||
{ | ||
$this->db->join($condition); | ||
} | ||
$data = $this->db->get(); | ||
return $data; | ||
} | ||
function update($what, $where=FALSE) | ||
{ | ||
if ($where != FALSE) $this->db->where($where); | ||
return (bool) $this->db->update('user_groups', $what); | ||
} | ||
function delete($condition) | ||
{ | ||
return (bool) $this->db->delete('user_groups', $condition); | ||
}*/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php if ( ! defined('BASEPATH')) die('No direct script access allowed'); | ||
|
||
class User_in_groups extends CActiveRecord { | ||
|
||
/** | ||
* Returns the static model of Settings table | ||
* | ||
* @static | ||
* @access public | ||
* @return CActiveRecord | ||
*/ | ||
public static function model() | ||
{ | ||
return parent::model(__CLASS__); | ||
} | ||
|
||
/** | ||
* Returns the setting's table name to be used by the model | ||
* | ||
* @access public | ||
* @return string | ||
*/ | ||
public function tableName() | ||
{ | ||
return '{{user_in_groups}}'; | ||
} | ||
|
||
/** | ||
* Returns the primary key of this table | ||
* | ||
* @access public | ||
* @return string | ||
*/ | ||
public function primaryKey() | ||
{ | ||
return 'uid'; | ||
} | ||
|
||
/*function getAllRecords($condition=FALSE) | ||
{ | ||
if ($condition != FALSE) | ||
{ | ||
$this->db->where($condition); | ||
} | ||
$data = $this->db->get('user_in_groups'); | ||
return $data; | ||
} | ||
function getSomeRecords($fields,$condition=FALSE) | ||
{ | ||
foreach ($fields as $field) | ||
{ | ||
$this->db->select($field); | ||
} | ||
if ($condition != FALSE) | ||
{ | ||
$this->db->where($condition); | ||
} | ||
$data = $this->db->get('user_in_groups'); | ||
return $data; | ||
} | ||
function insert($data) | ||
{ | ||
return (bool) $this->db->insert('user_in_groups', $data); | ||
} | ||
function join($fields, $from, $condition=FALSE, $join=FALSE, $order=FALSE) | ||
{ | ||
foreach ($fields as $field) | ||
{ | ||
$this->db->select($field); | ||
} | ||
$this->db->from($from); | ||
if ($condition != FALSE) | ||
{ | ||
$this->db->where($condition); | ||
} | ||
if ($order != FALSE) | ||
{ | ||
$this->db->order_by($order); | ||
} | ||
if (isset($join['where'], $join['type'], $join['on'])) | ||
{ | ||
$this->db->join($condition); | ||
} | ||
$data = $this->db->get(); | ||
return $data; | ||
}*/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.