models/Project.phpView Source

Show: PublicProtectedPrivateinherited
Table of Contents
Package
Default  

\Project

Package: Models
Project
Parent(s)
\Scout_Db_Table
Access
public  
Author
Alexander  
Copyright
2011  
Version
$Id$  

Constants

>VConstant  DONE = 0
>VConstant  STOPPED = 96
>VConstant  IN_USE = 99
>VConstant  OVER_QUOTA = 94
>VConstant  ZERO_QUOTA = 95
>VConstant  FINAL_REMOVED = 93
>VConstant  DATASOURCE_LISTFILE = 1
>VConstant  DATASOURCE_EMAIL = 1
>VConstant  DATASOURCE_BANNER = 2
>VConstant  DATASOURCE_IPANEL = 4
>VConstant  DATASOURCE_MARSC = 5
>VConstant  DATASOURCE_ONGOING = 6
>VConstant  PROJECT_TYPE_UNKNOWN = 0
>VConstant  PROJECT_TYPE_CATI = 1
>VConstant  PROJECT_TYPE_WAPI = 2
>VConstant  PROJECT_TYPE_BOTH = 3

Properties

>VPropertyprotectedstring $_name = 'projects'
table name
Default value'projects'Details
Type
string
>VPropertyprotectedstring $_schema = 'scout_project'
db name
Default value'scout_project'Details
Type
string
>VPropertyprivate$_testInfoMode = 0
Default value0Details
Type
n/a
>VPropertyprivate$db
Details
Type
n/a
>VPropertypublic$id
Details
Type
n/a
>VPropertypublic$lid
Details
Type
n/a
>VPropertyprivate$projectType
Details
Type
n/a

Methods

methodpublicadd_data(mixed $new_id, mixed $lid) : void

Add data from another listfile (for multiple listfiles)

Parameters
NameTypeDescription
$new_idmixed
$lidmixed
methodpubliccheckAndMarkCOverquotas(object $projectInfo, mixed $sfRow) : void

Check repondent data and mark if it owerqupta by some values

Parameters
NameTypeDescription
$projectInfoobject
$sfRowmixed
methodpubliccheckAutoDialAllow(integer $project_id) : integer

Check project status if allowed auto dial

Parameters
NameTypeDescription
$project_idinteger
Returns
TypeDescription
integer
methodpubliccheckInBlacklist( $email) : void

Parameters
NameTypeDescription
$email
methodpubliccheckQuota(array $quota, mixed $sf_user) : boolean

Check repondent data

Parameters
NameTypeDescription
$quotaarray
$sf_usermixed
Returns
TypeDescription
boolean
methodpubliccheck_finish( $pid) : void

Parameters
NameTypeDescription
$pid
methodpubliccleanNotFinished() : void

Delete not finished temp tables from db

methodpubliccopy(mixed $lid, mixed $new_id, string $list_db = 'scout_listfile') :

Copy data from listfile to project

Parameters
NameTypeDescription
$lidmixed
$new_idmixed
$list_dbstring
methodpubliccreateSfStructure(array $data, integer $data_source, integer $project_type) : void

Create all db tables that need for sample file

Parameters
NameTypeDescription
$dataarray
$data_sourceinteger
$project_typeinteger
methodpublicdeleteBlacklist(integer $id) : boolean

Delete black list items by ids

Parameters
NameTypeDescription
$idinteger
Returns
TypeDescription
boolean
methodpublicdelete_data(mixed $proj_id) : void

Delete project data

Parameters
NameTypeDescription
$proj_idmixed
methodpublicexpand_data(array $selected = array(), array $selected_var = array(), integer $limit, string $type = 'as_is', integer $listfile_id) : void

Expand project

Parameters
NameTypeDescription
$selectedarray
$selected_vararray
$limitinteger
$typestring
$listfile_idinteger
methodprivatefillUpProjProperties( $rowObject) : void

Parameters
NameTypeDescription
$rowObject
methodpublicgen_link(object $sess, integer $type, boolean $token = false, boolean $popup = false) : string

Generate link for web based rojects

Parameters
NameTypeDescription
$sessobject
$typeinteger
$tokenboolean
$popupboolean
Returns
TypeDescription
string
methodpublicgen_link_unsub( $sess,  $token) : string

Generate ling that allow unsubsribe for emails

Parameters
NameTypeDescription
$sess
$token
Returns
TypeDescription
string
methodpublicgen_test_link(object $sess, integer $type) : string

Generate test link from banner type rojects

Parameters
NameTypeDescription
$sessobject
$typeinteger
Returns
TypeDescription
string
methodpublicgenerateEmailBody( $user,  $sess, string $body) : string

Generate nice email body

Parameters
NameTypeDescription
$user
$sess
$bodystring
Returns
TypeDescription
string
methodpublicgenerateEmailBodyForMailgun(string $body) : string

Generate nice email body fro mailgun

Parameters
NameTypeDescription
$bodystring
Returns
TypeDescription
string
methodpublicgetAllProjects() : array

To get all pairs ID=>ProjectName registered in system

Returns
TypeDescription
arrayidNamePairs
methodpublicgetAllProjectsByC( $aProjectIds = array(),  $type = '') : void

Parameters
NameTypeDescription
$aProjectIds
$type
methodpublicgetAllProjectsByGroup(integer $groupId = 0) : array

For Client Admin. To show all LISTFILE based projects in same group as Current project.

For Super Admin - senseless request! To show only projects in 0 group! Unlogic for now!

Parameters
NameTypeDescription
$groupIdinteger
Returns
TypeDescription
arrayisNamePairs
methodpublicgetAllProjectsByQst( $qstId) : array

For Client Admin. To show all projects in same group as QST linked to QST

Parameters
NameTypeDescription
$qstId
Returns
TypeDescription
arrayisNamePairs
methodpublicgetAllProjectsByUser() : array

For Client Admin. To show all LISTFILE based projects in same group as Client Admin.

For Super Admin - senseless request! To show only projects in 0 group! Unlogic for now!

Returns
TypeDescription
arrayisNamePairs
methodpublicgetAns(integer $proj_id, integer $user_id) : mixed

Get all saved answers for some respondent

Parameters
NameTypeDescription
$proj_idinteger
$user_idinteger
Returns
TypeDescription
mixed
methodpublicgetAnsInfo(integer $proj_id, integer $user_id) : mixed

Populate answers with questionnaire aswer data

Parameters
NameTypeDescription
$proj_idinteger
$user_idinteger
Returns
TypeDescription
mixed
methodpublicgetBlacklist(string $filter = false) : mixed

Get black listed fileds

Parameters
NameTypeDescription
$filterstring
Returns
TypeDescription
mixed
methodpublicgetByHash(string $hash) : mixed

get repondent record by hash

Parameters
NameTypeDescription
$hashstring
Returns
TypeDescription
mixed
methodpublicgetById(integer $id) : Object

Get all project data by id

Parameters
NameTypeDescription
$idinteger
Returns
TypeDescription
Object
methodpublicgetCFSTitles(integer $project_id) : array

Returned structure of project VARS by types and sort numbers

Parameters
NameTypeDescription
$project_idinteger
Returns
TypeDescription
array
methodpublicgetCodeContent( $code) : void

Parameters
NameTypeDescription
$code
methodpublicgetDataCol() :

Get tp columns

methodpublicgetDistrInfo(mixed $field_id) :

Get distribution table

Parameters
NameTypeDescription
$field_idmixed
methodpublicgetEmailsData(array $fields, array $stat = array(), array $vars = array()) : array

Get email respondents data for project

Parameters
NameTypeDescription
$fieldsarray
$statarray
$varsarray
Returns
TypeDescription
array
methodpublicgetFieldColumnsIndexes(boolean $where = "") : array | boolean

Get sample file columns data

Parameters
NameTypeDescription
$whereboolean
Returns
TypeDescription
array | boolean
methodpublicgetFields( $where = false) : void

Get fields

param bool $where return

Parameters
NameTypeDescription
$where
methodpublicgetGroupId(integer $projectId = 0) : object

Get current project goroup id it belongs to

Parameters
NameTypeDescription
$projectIdinteger
Returns
TypeDescription
object
methodpublicgetIdsByEmails(array $fields) : array

get repondent id by emails

Parameters
NameTypeDescription
$fieldsarray
Returns
TypeDescription
array
methodpublicgetListByIds(array $aIds) : array

Get list of project by ids

Parameters
NameTypeDescription
$aIdsarray
Returns
TypeDescription
array
methodpublicgetNameQuota(integer $id) : object

Get fiels name data for quota use

Parameters
NameTypeDescription
$idinteger
Returns
TypeDescription
object
methodpublicgetObservers( $projectId) : array

To get observers ID array for pointed project

Parameters
NameTypeDescription
$projectId
Returns
TypeDescription
array
methodpublicgetOneVar(integer $row_id, integer $field_id) : mixed

Get data for one record

Parameters
NameTypeDescription
$row_idinteger
$field_idinteger
Returns
TypeDescription
mixed
methodpublicgetProjectType() : object

Get project data orce type

Returns
TypeDescription
object
methodpublicgetSfListFiltered(integer $filter = '',  $start = 0,  $limit = 30) : mixed

Get sample file list filtered

Parameters
NameTypeDescription
$filterinteger
$start
$limit
Returns
TypeDescription
mixed
methodpublicgetSfRowById(integer $sfId) : mixed

Get repondent recored by id

Parameters
NameTypeDescription
$sfIdinteger
Returns
TypeDescription
mixed
methodpublicgetTotalRecord( $selected,  $selected_var) : void

Get total available records by selected C|F vars

param mixed $field_id param mixed $selected param mixed $selected_var return

Parameters
NameTypeDescription
$selected
$selected_var
methodpublicgetTpCol() :

Get tp columns

methodpublicgetTpInfo(mixed $field_id, boolean $where = false, boolean $order = false) :

Get data twrgeet population info

Parameters
NameTypeDescription
$field_idmixed
$whereboolean
$orderboolean
methodpublicgetUnionVars(array $proj_ids, integer $field_id) : array

Get vars after union by filed

Parameters
NameTypeDescription
$proj_idsarray
$field_idinteger
Returns
TypeDescription
array
methodpublicgetVarsInfo(mixed $field_id, boolean $where = false, boolean $order = false) :

Get all vars information by fielsd id

Parameters
NameTypeDescription
$field_idmixed
$whereboolean
$orderboolean
methodpublicgetVarsInfoFiltered(integer $field_id, array $selected, array $selected_var, boolean $get_all = false) : array

Get variavles from project data filetered by some value

Parameters
NameTypeDescription
$field_idinteger
$selectedarray
$selected_vararray
$get_allboolean
Returns
TypeDescription
array
methodpublicgetVarsOnly( $field_id) : void

Get variables by field id

param mixed $field_id return

Parameters
NameTypeDescription
$field_id
methodpublicgetVarsTable(boolean $where = false, boolean $order = false) :

Project::getVarsTable()

Parameters
NameTypeDescription
$whereboolean
$orderboolean
methodpublicgetWapiStatuses() : \array_pairs
static

Return array of statuses_id and statuses names from abonent_status_hierarhy table. It Can be used for translate email statuses to text

Returns
TypeDescription
\array_pairs
methodpublicget_data(array $selected = array(), array $selected_var = array(), integer $tp = 501, string $type = 'as_is', boolean $quota = false, boolean $make_sf = false) : mixed

Parameters
NameTypeDescription
$selectedarray

selected C vars

$selected_vararray

values of selected C vars

$tpinteger

target population size. -1 == unlimited

$typestring

sample selection type Probability or AS_IS

$quotaboolean

Quota limitation array

$make_sfboolean

make SampleFile or return selected data

Returns
TypeDescription
mixed
methodpublicinit() : void

methodpublicinit_banner(string $lid) : void

Init projet db struncture for banner project type

Parameters
NameTypeDescription
$lidstring
methodpublicinit_ongoing() :

Init ongoing project

methodpublicmakeDistrTable(mixed $field_id, mixed $data, mixed $need) : void

Make ditribution table

Parameters
NameTypeDescription
$field_idmixed
$datamixed
$needmixed
methodpublicmb_str_replace(string $search, string $replace, string $subject) : string

Replace function for UTF8 strings

Parameters
NameTypeDescription
$searchstring
$replacestring
$subjectstring
Returns
TypeDescription
string
methodpublicnestingVal(mixed $field_ids, mixed $selected) : void

For nesting vals data

Parameters
NameTypeDescription
$field_idsmixed
$selectedmixed
methodpublicrecodeVal(mixed $codes, mixed $field_id, mixed $name) : void

Recoding vars

Parameters
NameTypeDescription
$codesmixed
$field_idmixed
$namemixed
methodpublicrenameList(mixed $oldname, mixed $newname) : void

Rename project (use for rename tmporary - not saved listfiles)

Parameters
NameTypeDescription
$oldnamemixed
$newnamemixed
methodpublicselect_user(object $proj) : mixed

select user for make interview DEPRECATED

Parameters
NameTypeDescription
$projobject
Returns
TypeDescription
mixed
methodpublicsetAbonentToCOverQuota(integer $mySfId) : void

Add record to log for for first repondednt phone with status EXTRA for current time make statup popup in all calculations

Parameters
NameTypeDescription
$mySfIdinteger
methodpublicsetProjectId( $projectId) : void

Set ID and create "lid" for current project

Parameters
NameTypeDescription
$projectId
methodpublicsetProjectType( $projectType) : void

Set project type Project::PROJECT_TYPE_CATI or Project::PROJECT_TYPE_WAPI By default set WAPI

Parameters
NameTypeDescription
$projectType
methodpublicsetTestInfoMode(integer $value = 1) : void

To set Test mode for project managing. Used in TestInfo action for visual testing Project data during project creation.

Parameters
NameTypeDescription
$valueinteger
methodpublicsf_size(string $lid) : integer

Get simele file count items

Parameters
NameTypeDescription
$lidstring
Returns
TypeDescription
integer
methodpublictotalEnded() : integer

Get count of respondent finished survey

Returns
TypeDescription
integer
methodpublictotalLeft() : integer

Calculating how many respondents still present in project quota. Count difference between target population size and completed surveys

Returns
TypeDescription
integer
methodpublicupdateLastLoadedTemplate( $projectId,  $templateId) : void

Store in project table ID of the last loaded template of statuses

Parameters
NameTypeDescription
$projectId
$templateId
methodpublicupdateObservers( $projectId, array $aObservers = array()) : void

Update (remove/insert) observers for pointed project

Parameters
NameTypeDescription
$projectId
$aObserversarray
Documentation was generated by phpDocumentor 2.8.5.