Welcompose
[ class tree: Welcompose ] [ index: Welcompose ] [ all elements ]

Class: Application_Project

Source Location: /application_classes/project.class.php

Class Overview




Variables

Methods



Class Details

[line 38]


[ Top ]


Class Variables

static $instance =  null

[line 45]

Singleton



Tags:

access:  public

Type:   object


[ Top ]

$base =  null

[line 52]

Reference to base class



Tags:

access:  public

Type:   object


[ Top ]

$_skeleton =  null

[line 59]

Container for XML skeleton



Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


constructor __construct [line 66]

Application_Project __construct( )

Start instance of base class, load configuration and establish database connection. Please don't call the constructor direcly, use the singleton pattern instead.



Tags:

access:  public


[ Top ]

method addProject [line 92]

int addProject( array $sqlData)

Creates new project. Takes field=>value array with project data as first argument. Returns insert id.



Tags:

throws:  Application_ProjectException
access:  public


Parameters:

array   $sqlData   Row data

[ Top ]

method assignUsersToInitProject [line 716]

bool assignUsersToInitProject( array $selected_users, int $project)

Assign one or more user to the initialized project. All neccessary data like groups and rights will be assigned or copied to the new project. Takes the users array as first and the project id as second argument. Returns bool.

Right now we do not follow user rights, which are not part of the init project skeleton table.




Tags:

throws:  Application_ProjectException
access:  public


Parameters:

array   $selected_users   Selected Users
int   $project   Project id

[ Top ]

method countProjects [line 362]

int countProjects( [array $params = array()])

Method to count available projects. Takes key=>value array with select params as first argument. Returns int.

List of supported params:

  • owner, int, optional: Project owner id
  • name, string, optional: Project name




Tags:

throws:  Application_ProjectException
access:  public


Parameters:

array   $params   Select params

[ Top ]

method deleteProject [line 154]

int deleteProject( int $id)

Removes project from the project table. Takes the project id as first argument. Returns amount of affected rows.



Tags:

return:  Amount of affected rows
throws:  Application_ProjectException
access:  public


Parameters:

int   $id   Project id

[ Top ]

method getGroupsFromSkeleton [line 894]

array getGroupsFromSkeleton( )

Returns array of groups configured in the skeleton.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method getPageTypesFromSkeleton [line 956]

array getPageTypesFromSkeleton( )

Returns array of page types configured in the skeleton.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method getPodcastCategoriesFromSkeleton [line 1060]

array getPodcastCategoriesFromSkeleton( )

Returns array of podcast categories configured in the skeleton.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method getRightsFromSkeleton [line 861]

array getRightsFromSkeleton( )

Returns array of rights configured in the skeleton.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method getTemplateTypesFromSkeleton [line 982]

array getTemplateTypesFromSkeleton( )

Returns array of template types configured in the skeleton.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method getTextConvertersFromSkeleton [line 1035]

array getTextConvertersFromSkeleton( )

Returns array of text converters configured in the skeleton.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method getTextMacrosFromSkeleton [line 1008]

array getTextMacrosFromSkeleton( )

Returns array of text macros configured in the skeleton.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method getUsersFromSkeleton [line 921]

array getUsersFromSkeleton( )

Returns array of users configured in the skeleton.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method initFromSkeleton [line 808]

bool initFromSkeleton( int $project)

Initializes project using the provided skeleton definition.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_Project
access:  public


Parameters:

int   $project   Project id

[ Top ]

method initProjectAdmin [line 607]

int initProjectAdmin( int $user)

Makes sure that a user session is always attached to a project. Returns id of the current project.



Tags:

return:  Project id
throws:  Application_ProjectException
access:  public


Parameters:

int   $user   User id

[ Top ]

method initProjectPublicArea [line 647]

int initProjectPublicArea( )

Sets WCOM_CURRENT_PROJECT constant. Returns id of the current project.



Tags:

return:  Project id
access:  public


[ Top ]

method loadSkeleton [line 839]

array loadSkeleton( )

Loads skeleton from xml file and stores result in self::_skeleton. If the skeleton was already loaded once, the function will return the cached result.



Tags:

throws:  Application_ProjectException
access:  protected


[ Top ]

method projectExists [line 498]

bool projectExists( int $id)

Checks if a project with the given id exists or not. Takes the project id as first argument, returns bool.



Tags:

throws:  Application_ProjectException
access:  public


Parameters:

int   $id   Project id

[ Top ]

method selectDefaultProject [line 419]

array selectDefaultProject( )

Looks for default project and returns array with project information. Throws exception if no default project can be found.



Tags:

throws:  Application_ProjectException
access:  public


[ Top ]

method selectProject [line 186]

array selectProject( int $id)

Selects one project. Takes the project id as first argument.

Returns array with project information.




Tags:

throws:  Application_ProjectException
access:  public


Parameters:

int   $id   Project id

[ Top ]

method selectProjects [line 251]

array selectProjects( [array $params = array()])

Method to select one or more projects. Takes key=>value array with select params as first argument. Returns array.

List of supported params:

  • owner, int, optional: Project owner id
  • name, string, optional: Project name
  • start, int, optional: row offset
  • limit, int, optional: amount of rows to return
  • order_marco, string, otpional: How to sort the result set. Supported macros:
    • DATE_ADDED: sort by date added
    • DATE_MODIFIED: sort by date modified
    • NAME: sort by name




Tags:

throws:  Application_ProjectException
access:  public


Parameters:

array   $params   Select params

[ Top ]

method selectProjectUsingUrlName [line 454]

array selectProjectUsingUrlName( string $name_url)

Looks for a project with the given url name and returns array with project information. Throws exception if no project with the given name can be found.



Tags:

throws:  Application_ProjectException
access:  public


Parameters:

string   $name_url   Project's url name

[ Top ]

method switchProject [line 686]

bool switchProject( int $new_project)

Switches current project. Takes the id of the new project as first argument. Returns bool.



Tags:

throws:  Application_ProjectException
access:  public


Parameters:

int   $new_project   Project id

[ Top ]

method syncGroupsWithSkeleton [line 1363]

bool syncGroupsWithSkeleton( int $project, [bool $drop_obsolete = false])

Synchronises groups in database with the list of groups deposited in the skeleton. Groups in the database that are not in the skeleton anymore will be removed, differences in descriptions etc.

will be synchronised and new groups in the skeleton will be added.

Takes the project id as first argument and a boolean value whether obsolete groups (= not mentioned in the skeleton anymore) should be dropped or not. Returns bool.

Note: The paramater $drop_obsolete should be used with care. That's because the sync function cannot distinguish whether a group was created from skeleton or by the user through the admin interface. So if drop_obsolete evaluates to true, groups created by the user would be deleted too.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id
bool   $drop_obsolete   Drop obsolete groups

[ Top ]

method syncLinksBetweenGroupsAndRightsWithSkeleton [line 1231]

bool syncLinksBetweenGroupsAndRightsWithSkeleton( int $project)

Synchronises links between groups and rights using the skeleton.

Only links to rights that are configured in the skeleton will be touched. So it's recommended that you first run the functions to sync rights and groups with the skeleton.

Takes the project id as fisrt argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id

[ Top ]

method syncLinksBetweenUsersAndGroupsWithSkeleton [line 1754]

bool syncLinksBetweenUsersAndGroupsWithSkeleton( int $project)

Synchronises links between users and groups with skeleton.

Only users configured in the skeleton will be touched.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id

[ Top ]

method syncLinksBetweenUsersAndProjectsWithSkeleton [line 1636]

bool syncLinksBetweenUsersAndProjectsWithSkeleton( in $project)

Synchronises links between users and projects with skeleton.

Only users that are configured in the skeleton will be touched.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  public


Parameters:

in   $project   Project Id

[ Top ]

method syncPageTypesWithSkeleton [line 1918]

bool syncPageTypesWithSkeleton( int $project)

Synchronises page types in database with the list of page types

deposited in the skeleton. Page types in the database that are not in the skeleton anymore will be removed, differences in descriptions etc. will be synchronised and new page types in the skeleton will be added.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id

[ Top ]

method syncPodcastCategoriesWithSkeleton [line 2449]

bool syncPodcastCategoriesWithSkeleton( int $project)

Synchronises podcast categories in database with the list of podcast categories deposited in the skeleton. Podcast categories in the database that are not in the skeleton anymore will be removed, differences will be synchronised and new podcast categories in the skeleton will be added.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id

[ Top ]

method syncRightsWithSkeleton [line 1098]

bool syncRightsWithSkeleton( int $project)

Synchronises rights in database with the list of rights deposited in the skeleton. Rights in the database that are not in the skeleton anymore will be removed, differences in descriptions etc.

will be synchronised and new rights in the skeleton will be added. Links between rights and groups won't be updated.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id

[ Top ]

method syncTemplateTypesWithSkeleton [line 2052]

bool syncTemplateTypesWithSkeleton( int $project)

Synchronises template types in database with the list of template types

deposited in the skeleton. Template types in the database that are not in the skeleton anymore will be removed, differences in descriptions etc. will be synchronised and new template types in the skeleton will be added.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id

[ Top ]

method syncTextConvertersWithSkeleton [line 2322]

bool syncTextConvertersWithSkeleton( int $project)

Synchronises text converters in database with the list of text converters

deposited in the skeleton. Text converters in the database that are not in the skeleton anymore will be removed, differences in internal_names etc. will be synchronised and new text converters in the skeleton will be added.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id

[ Top ]

method syncTextMacrosWithSkeleton [line 2186]

bool syncTextMacrosWithSkeleton( int $project)

Synchronises text macros in database with the list of text macros

deposited in the skeleton. Text macros in the database that are not in the skeleton anymore will be removed, differences in internal_names etc. will be synchronised and new text macros in the skeleton will be added.

Takes the project id as first argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id

[ Top ]

method syncUsersWithSkeleton [line 1505]

bool syncUsersWithSkeleton( int $project, [bool $drop_obsolete = false])

Sychronises users with skeleton. Adds new users and updates existing ones. If drop_obsolete is true, obsolete/orphaned users will be deleted.

A user is obsolete or orphaned, if it's not attached to any project.

Takes the project id as first argument and a boolean value whether obsolete/orphaned users should be deleted as second argument. Returns bool.




Tags:

throws:  Application_ProjectException
access:  protected


Parameters:

int   $project   Project id
bool   $drop_obsolete   Drop obsolete

[ Top ]

method testForUniqueName [line 543]

bool testForUniqueName( string $name, [int $id = null])

Tests given project name for uniqueness. Takes the project name as

first argument and an optional project id as second argument. If the project id is given, this project won't be considered when checking for uniqueness (useful for updates). Returns boolean true if project name is unique.




Tags:

throws:  Application_ProjectException
access:  public


Parameters:

string   $name   Project name
int   $id   Project id

[ Top ]

method updateProject [line 118]

int updateProject( int $id, array $sqlData)

Updates project. Takes the project id as first argument, a field=>value array with the new row data as second argument. Returns amount of affected rows.



Tags:

return:  Affected rows
throws:  Application_ProjectException
access:  public


Parameters:

int   $id   Project id
array   $sqlData   Row data

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:51:57 +0100 by phpDocumentor 1.4.3