/php/lib/data_manager/database_internship_organizer_data_manager.class.php
PHP | 897 lines | 654 code | 235 blank | 8 comment | 13 complexity | c026116fca0853bf2772fdb267e1868f MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php
- namespace application\internship_organizer;
-
- use common\libraries\ObjectTableOrder;
- use common\libraries\InequalityCondition;
- use common\libraries\WebApplication;
- use common\libraries\Database;
- use common\libraries\Translation;
- use common\libraries\EqualityCondition;
- use common\libraries\AndCondition;
- use common\libraries\InCondition;
- use common\libraries\Session;
- use common\libraries\ConditionTranslator;
-
- use repository\RepositoryDataManager;
- use repository\ContentObject;
- use repository\ContentObjectPublicationAttributes;
-
- use user\UserDataManager;
- use user\User;
-
- use group\Group;
- use group\GroupDataManager;
- /**
- * @package internship_organizer.datamanager
- */
-
- require_once dirname(__FILE__) . '/../internship_organizer_data_manager.interface.php';
-
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'category.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'location.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'category_rel_location.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'category_rel_period.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'organisation.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'organisation_rel_user.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'agreement.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'agreement_rel_location.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'agreement_rel_user.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'agreement_rel_mentor.class.php';
-
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'appointment.class.php';
-
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'publication.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'publication_place.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'publication_type.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'publication_place.class.php';
-
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'moment.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'mentor.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'mentor_rel_user.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'mentor_rel_location.class.php';
-
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'region.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'period.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'period_rel_user.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'period_rel_group.class.php';
- require_once WebApplication :: get_application_class_lib_path('internship_organizer') . 'user_type.class.php';
-
- class DatabaseInternshipOrganizerDataManager extends Database implements InternshipOrganizerDataManagerInterface
- {
-
- const STATUS = 'status';
- const MESSAGE = 'message';
-
- function initialize()
- {
- parent :: initialize();
- $this->set_prefix('internship_organizer_');
-
- }
-
- //internship planner locations
-
-
- function create_internship_organizer_location($location)
- {
- return $this->create($location);
- }
-
- function update_internship_organizer_location($location)
- {
- $condition = new EqualityCondition(InternshipOrganizerLocation :: PROPERTY_ID, $location->get_id());
- return $this->update($location, $condition);
- }
-
- function delete_internship_organizer_location($location)
- {
- $condition = new EqualityCondition(InternshipOrganizerLocation :: PROPERTY_ID, $location->get_id());
- return $this->delete($location->get_table_name(), $condition);
- }
-
- function retrieve_location($id)
- {
- $condition = new EqualityCondition(InternshipOrganizerLocation :: PROPERTY_ID, $id);
- return $this->retrieve_object(InternshipOrganizerLocation :: get_table_name(), $condition, array(), InternshipOrganizerLocation :: CLASS_NAME);
- }
-
- function retrieve_locations($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
-
- $region_alias = $this->get_alias(InternshipOrganizerRegion :: get_table_name());
- $organisation_alias = $this->get_alias(InternshipOrganizerOrganisation :: get_table_name());
- $location_alias = $this->get_alias(InternshipOrganizerLocation :: get_table_name());
-
- $query = 'SELECT ' . $location_alias . '.* ,' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_ID, $region_alias) . 'as Region_Id, ' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_ZIP_CODE, $region_alias) . ',' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_CITY_NAME, $region_alias);
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerLocation :: get_table_name()) . ' AS ' . $location_alias;
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerOrganisation :: get_table_name()) . ' AS ' . $organisation_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ORGANISATION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_alias);
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerRegion :: get_table_name()) . ' AS ' . $region_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_REGION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_ID, $region_alias);
-
- return $this->retrieve_object_set($query, InternshipOrganizerLocation :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerLocation :: CLASS_NAME);
- }
-
- function count_locations($condition = null)
- {
- $region_alias = $this->get_alias(InternshipOrganizerRegion :: get_table_name());
- $organisation_alias = $this->get_alias(InternshipOrganizerOrganisation :: get_table_name());
- $location_alias = $this->get_alias(InternshipOrganizerLocation :: get_table_name());
-
- $query = 'SELECT COUNT(* ) ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerLocation :: get_table_name()) . ' AS ' . $location_alias;
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerOrganisation :: get_table_name()) . ' AS ' . $organisation_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ORGANISATION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_alias);
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerRegion :: get_table_name()) . ' AS ' . $region_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_REGION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_ID, $region_alias);
-
- return $this->count_result_set($query, InternshipOrganizerLocation :: get_table_name(), $condition);
- }
-
- //internship planner organisations
-
-
- function create_internship_organizer_organisation($organisation)
- {
- return $this->create($organisation);
- }
-
- function update_internship_organizer_organisation($organisation)
- {
- $condition = new EqualityCondition(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation->get_id());
- return $this->update($organisation, $condition);
- }
-
- function delete_internship_organizer_organisation($organisation)
- {
- $condition = new EqualityCondition(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation->get_id());
- return $this->delete($organisation->get_table_name(), $condition);
- }
-
- function count_organisations($condition = null)
- {
- return $this->count_objects(InternshipOrganizerOrganisation :: get_table_name(), $condition);
- }
-
- function retrieve_organisation($id)
- {
- $condition = new EqualityCondition(InternshipOrganizerOrganisation :: PROPERTY_ID, $id);
- return $this->retrieve_object(InternshipOrganizerOrganisation :: get_table_name(), $condition, array(), InternshipOrganizerOrganisation :: CLASS_NAME);
- }
-
- function retrieve_organisations($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
- return $this->retrieve_objects(InternshipOrganizerOrganisation :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerOrganisation :: CLASS_NAME);
- }
-
- function delete_internship_organizer_organisation_rel_user($organisation_rel_user)
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerOrganisationRelUser :: PROPERTY_USER_ID, $organisation_rel_user->get_user_id());
- $conditions[] = new EqualityCondition(InternshipOrganizerOrganisationRelUser :: PROPERTY_ORGANISATION_ID, $organisation_rel_user->get_organisation_id());
- $condition = new AndCondition($conditions);
- $bool = $this->delete($organisation_rel_user->get_table_name(), $condition);
- if ($bool)
- {
- $conditions = array();
- $user_alias = UserDataManager :: get_instance()->get_alias(User :: get_table_name());
-
- $conditions[] = new EqualityCondition(User :: PROPERTY_ID, $organisation_rel_user->get_user_id(), $user_alias, true);
- $conditions[] = new EqualityCondition(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_rel_user->get_organisation_id(), InternshipOrganizerOrganisation :: get_table_name());
- $condition = new AndCondition($conditions);
- $mentor_rel_users = $this->retrieve_mentor_rel_users($condition);
- $mentor_ids = array();
- while ($mentor_rel_user = $mentor_rel_users->next_result())
- {
- $mentor_ids[] = $mentor_rel_user->get_mentor_id();
- }
- $mentor_ids = array_unique($mentor_ids);
- if (count($mentor_ids))
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerMentorRelUser :: PROPERTY_USER_ID, $organisation_rel_user->get_user_id(), InternshipOrganizerMentorRelUser :: get_table_name());
- $conditions[] = new InCondition(InternshipOrganizerMentorRelUser :: PROPERTY_MENTOR_ID, $mentor_ids);
- $condition = new AndCondition($conditions);
- $this->delete(InternshipOrganizerMentorRelUser :: get_table_name(), $condition);
- }
-
- }
-
- return $bool;
- }
-
- function create_internship_organizer_organisation_rel_user($organisation_rel_user)
- {
- return $this->create($organisation_rel_user);
- }
-
- function count_organisation_rel_users($condition = null)
- {
- $organisation_alias = $this->get_alias(InternshipOrganizerOrganisation :: get_table_name());
- $organisation_rel_user_alias = $this->get_alias(InternshipOrganizerOrganisationRelUser :: get_table_name());
- $user_alias = UserDataManager :: get_instance()->get_alias(User :: get_table_name());
-
- $query = 'SELECT COUNT(DISTINCT ' . $this->escape_column_name(User :: PROPERTY_ID, $user_alias) . ')';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerOrganisationRelUser :: get_table_name()) . ' AS ' . $organisation_rel_user_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerOrganisation :: get_table_name()) . ' AS ' . $organisation_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerOrganisationRelUser :: PROPERTY_ORGANISATION_ID, $organisation_rel_user_alias);
-
- $query .= ' JOIN ' . UserDataManager :: get_instance()->escape_table_name(User :: get_table_name()) . ' AS ' . $user_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerOrganisationRelUser :: PROPERTY_USER_ID, $organisation_rel_user_alias) . ' = ' . $this->escape_column_name(User :: PROPERTY_ID, $user_alias);
- return $this->count_result_set($query, InternshipOrganizerOrganisationRelUser :: get_table_name(), $condition);
-
- }
-
- function retrieve_organisation_rel_users($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
- $organisation_alias = $this->get_alias(InternshipOrganizerOrganisation :: get_table_name());
- $organisation_rel_user_alias = $this->get_alias(InternshipOrganizerOrganisationRelUser :: get_table_name());
- $user_alias = UserDataManager :: get_instance()->get_alias(User :: get_table_name());
-
- $query = 'SELECT DISTINCT ' . $user_alias . '. * , ' . $organisation_rel_user_alias . '. * ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerOrganisationRelUser :: get_table_name()) . ' AS ' . $organisation_rel_user_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerOrganisation :: get_table_name()) . ' AS ' . $organisation_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerOrganisationRelUser :: PROPERTY_ORGANISATION_ID, $organisation_rel_user_alias);
-
- $query .= ' JOIN ' . UserDataManager :: get_instance()->escape_table_name(User :: get_table_name()) . ' AS ' . $user_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerOrganisationRelUser :: PROPERTY_USER_ID, $organisation_rel_user_alias) . ' = ' . $this->escape_column_name(User :: PROPERTY_ID, $user_alias);
-
- return $this->retrieve_object_set($query, InternshipOrganizerOrganisationRelUser :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerOrganisationRelUser :: CLASS_NAME);
-
- }
-
- function retrieve_organisation_rel_user($organisation_id, $user_id)
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerOrganisationRelUser :: PROPERTY_ORGANISATION_ID, $organisation_id);
- $conditions[] = new EqualityCondition(InternshipOrganizerOrganisationRelUser :: PROPERTY_USER_ID, $user_id);
- $condition = new AndCondition($conditions);
- return $this->retrieve_object(InternshipOrganizerOrganisationRelUser :: get_table_name(), $condition, array(), InternshipOrganizerOrganisationRelUser :: CLASS_NAME);
- }
-
- //internship planner categories
-
-
- function update_internship_organizer_category($category)
- {
- $condition = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_ID, $category->get_id());
- return $this->update($category, $condition);
- }
-
- function delete_internship_organizer_category($category)
- {
- $condition = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_ID, $category->get_id());
- $bool = $this->delete($category->get_table_name(), $condition);
-
- $condition_subcategories = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_PARENT_ID, $category->get_id());
- $categories = $this->retrieve_categories($condition_subcategories);
- while ($gr = $categories->next_result())
- {
- $bool = $bool & $this->delete_internship_organizer_category($gr);
- }
-
- $this->truncate_category($category);
-
- return $bool;
-
- }
-
- function truncate_category($category)
- {
- $condition = new EqualityCondition(InternshipOrganizerCategoryRelLocation :: PROPERTY_CATEGORY_ID, $category->get_id());
- return $this->delete(InternshipOrganizerCategoryRelLocation :: get_table_name(), $condition);
- }
-
- function delete_internship_organizer_category_rel_location($categoryrellocation)
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerCategoryRelLocation :: PROPERTY_CATEGORY_ID, $categoryrellocation->get_category_id());
- $conditions[] = new EqualityCondition(InternshipOrganizerCategoryRelLocation :: PROPERTY_LOCATION_ID, $categoryrellocation->get_location_id());
- $condition = new AndCondition($conditions);
-
- return $this->delete($categoryrellocation->get_table_name(), $condition);
- }
-
- function create_internship_organizer_category($category)
- {
- return $this->create($category);
- }
-
- function create_internship_organizer_category_rel_location($categoryrellocation)
- {
- return $this->create($categoryrellocation);
- }
-
- function count_categories($condition = null)
- {
- return $this->count_objects(InternshipOrganizerCategory :: get_table_name(), $condition);
- }
-
- function retrieve_categories($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
- return $this->retrieve_objects(InternshipOrganizerCategory :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerCategory :: CLASS_NAME);
- }
-
- function retrieve_internship_organizer_category($id)
- {
- $condition = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_ID, $id);
- return $this->retrieve_object(InternshipOrganizerCategory :: get_table_name(), $condition, array(), InternshipOrganizerCategory :: CLASS_NAME);
- }
-
- function retrieve_category_rel_locations($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
-
- $rel_alias = $this->get_alias(InternshipOrganizerCategoryRelLocation :: get_table_name());
- $region_alias = $this->get_alias(InternshipOrganizerRegion :: get_table_name());
- $category_alias = $this->get_alias(InternshipOrganizerCategory :: get_table_name());
- $organisation_alias = $this->get_alias(InternshipOrganizerOrganisation :: get_table_name());
- $location_alias = $this->get_alias(InternshipOrganizerLocation :: get_table_name());
-
- $query = 'SELECT ' . $rel_alias . '.* ,' . $location_alias . '.* ,' . $region_alias . '.*';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerCategoryRelLocation :: get_table_name()) . ' AS ' . $rel_alias;
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerLocation :: get_table_name()) . ' AS ' . $location_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategoryRelLocation :: PROPERTY_LOCATION_ID, $rel_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ID, $location_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerRegion :: get_table_name()) . ' AS ' . $region_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_REGION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_ID, $region_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerOrganisation :: get_table_name()) . ' AS ' . $organisation_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ORGANISATION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_alias);
-
- return $this->retrieve_object_set($query, InternshipOrganizerCategoryRelLocation :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerCategoryRelLocation :: CLASS_NAME);
- }
-
- function count_category_rel_locations($condition = null)
- {
- $rel_alias = $this->get_alias(InternshipOrganizerCategoryRelLocation :: get_table_name());
- $region_alias = $this->get_alias(InternshipOrganizerRegion :: get_table_name());
- $category_alias = $this->get_alias(InternshipOrganizerCategory :: get_table_name());
- $organisation_alias = $this->get_alias(InternshipOrganizerOrganisation :: get_table_name());
- $location_alias = $this->get_alias(InternshipOrganizerLocation :: get_table_name());
-
- $query = 'SELECT COUNT(* ) ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerCategoryRelLocation :: get_table_name()) . ' AS ' . $rel_alias;
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerLocation :: get_table_name()) . ' AS ' . $location_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategoryRelLocation :: PROPERTY_LOCATION_ID, $rel_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ID, $location_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerRegion :: get_table_name()) . ' AS ' . $region_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_REGION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_ID, $region_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerOrganisation :: get_table_name()) . ' AS ' . $organisation_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ORGANISATION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_alias);
-
- return $this->count_result_set($query, InternshipOrganizerCategoryRelLocation :: get_table_name(), $condition);
- }
-
- function retrieve_period_rel_locations($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
-
- $category_rel__location_alias = $this->get_alias(InternshipOrganizerCategoryRelLocation :: get_table_name());
- $category_rel_period_alias = $this->get_alias(InternshipOrganizerCategoryRelPeriod :: get_table_name());
-
- $category_alias = $this->get_alias(InternshipOrganizerCategory :: get_table_name());
- $organisation_alias = $this->get_alias(InternshipOrganizerOrganisation :: get_table_name());
- $location_alias = $this->get_alias(InternshipOrganizerLocation :: get_table_name());
-
- $query = 'SELECT ' . $category_rel_location_alias . ' * ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerCategoryRelLocation :: get_table_name()) . ' AS ' . $category_rel__location_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerCategoryRelPeriod :: get_table_name()) . ' AS ' . $category_rel_period_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategoryRelPeriod :: PROPERTY_CATEGORY_ID, $category_rel__location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerCategoryRelLocation :: PROPERTY_CATEGORY_ID, $category_rel__location_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerLocation :: get_table_name()) . ' AS ' . $location_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategoryRelLocation :: PROPERTY_LOCATION_ID, $category_rel__location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ID, $location_alias);
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerOrganisation :: get_table_name()) . ' AS ' . $organisation_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ORGANISATION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_alias);
-
- return $this->retrieve_object_set($query, InternshipOrganizerCategoryRelLocation :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerCategoryRelLocation :: CLASS_NAME);
- }
-
- function count_period_rel_locations($condition = null)
- {
-
- $category_rel__location_alias = $this->get_alias(InternshipOrganizerCategoryRelLocation :: get_table_name());
- $category_rel_period_alias = $this->get_alias(InternshipOrganizerCategoryRelPeriod :: get_table_name());
-
- $category_alias = $this->get_alias(InternshipOrganizerCategory :: get_table_name());
- $organisation_alias = $this->get_alias(InternshipOrganizerOrganisation :: get_table_name());
- $location_alias = $this->get_alias(InternshipOrganizerLocation :: get_table_name());
-
- $query = 'SELECT COUNT(* ) ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerCategoryRelLocation :: get_table_name()) . ' AS ' . $category_rel__location_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerCategoryRelPeriod :: get_table_name()) . ' AS ' . $category_rel_period_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategoryRelPeriod :: PROPERTY_CATEGORY_ID, $category_rel__location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerCategoryRelLocation :: PROPERTY_CATEGORY_ID, $category_rel__location_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerLocation :: get_table_name()) . ' AS ' . $location_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategoryRelLocation :: PROPERTY_LOCATION_ID, $category_rel__location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ID, $location_alias);
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerOrganisation :: get_table_name()) . ' AS ' . $organisation_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ORGANISATION_ID, $location_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerOrganisation :: PROPERTY_ID, $organisation_alias);
-
- return $this->count_result_set($query, InternshipOrganizerCategoryRelLocation :: get_table_name(), $condition);
- }
-
- function retrieve_category_rel_location($location_id, $category_id)
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerCategoryRelLocation :: PROPERTY_LOCATION_ID, $location_id);
- $conditions[] = new EqualityCondition(InternshipOrganizerCategoryRelLocation :: PROPERTY_CATEGORY_ID, $category_id);
- $condition = new AndCondition($conditions);
- return $this->retrieve_object(InternshipOrganizerCategoryRelLocation :: get_table_name(), $condition, array(), InternshipOrganizerCategoryRelLocation :: CLASS_NAME);
- }
-
- function retrieve_category_by_name($name)
- {
- $condition = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_NAME, $name);
- return $this->retrieve_object(InternshipOrganizerCategory :: get_table_name(), $condition);
- }
-
- function is_categoryname_available($categoryname, $category_id = null)
- {
- $condition = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_NAME, $categoryname);
-
- if ($category_id)
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_NAME, $categoryname);
- $conditions = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_ID, $category_id);
- $condition = new AndCondition($conditions);
- }
-
- return ! ($this->count_objects(InternshipOrganizerCategory :: get_table_name(), $condition) == 1);
- }
-
- function retrieve_category($category_id)
- {
- $condition = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_ID, $category_id);
- return $this->retrieve_object(InternshipOrganizerCategory :: get_table_name(), $condition, array(), InternshipOrganizerCategory :: CLASS_NAME);
- }
-
- function retrieve_root_category()
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerCategory :: PROPERTY_PARENT_ID, 0);
- $condition = new AndCondition($conditions);
- $root_category = $this->retrieve_categories($condition)->next_result();
- if (! isset($root_category))
- {
- $root_category = new InternshipOrganizerCategory();
- $root_category->set_name('ROOT');
- $root_category->set_parent_id(0);
- $root_category->create();
- }
- return $root_category;
- }
-
- function delete_internship_organizer_category_rel_period($category_rel_period)
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerCategoryRelPeriod :: PROPERTY_CATEGORY_ID, $category_rel_period->get_category_id());
- $conditions[] = new EqualityCondition(InternshipOrganizerCategoryRelPeriod :: PROPERTY_PERIOD_ID, $category_rel_period->get_period_id());
- $condition = new AndCondition($conditions);
- $bool = $this->delete($category_rel_period->get_table_name(), $condition);
- return $bool;
- }
-
- function create_internship_organizer_category_rel_period($category_rel_period)
- {
- return $this->create($category_rel_period);
- }
-
- function count_category_rel_periods($condition = null)
- {
-
- $category_alias = $this->get_alias(InternshipOrganizerCategory :: get_table_name());
- $category_rel_period_alias = $this->get_alias(InternshipOrganizerCategoryRelPeriod :: get_table_name());
- $period_alias = $this->get_alias(InternshipOrganizerPeriod :: get_table_name());
-
- $query = 'SELECT COUNT(* ) ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerCategoryRelPeriod :: get_table_name()) . ' AS ' . $category_rel_period_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerCategory :: get_table_name()) . ' AS ' . $category_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategory :: PROPERTY_ID, $category_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerCategoryRelPeriod :: PROPERTY_CATEGORY_ID, $category_rel_period_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerPeriod :: get_table_name()) . ' AS ' . $period_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategoryRelPeriod :: PROPERTY_PERIOD_ID, $category_rel_period_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerPeriod :: PROPERTY_ID, $period_alias);
-
- return $this->count_result_set($query, InternshipOrganizerCategoryRelPeriod :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerCategoryRelPeriod :: CLASS_NAME);
-
- }
-
- function retrieve_category_rel_periods($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
-
- $category_alias = $this->get_alias(InternshipOrganizerCategory :: get_table_name());
- $category_rel_period_alias = $this->get_alias(InternshipOrganizerCategoryRelPeriod :: get_table_name());
- $period_alias = $this->get_alias(InternshipOrganizerPeriod :: get_table_name());
-
- $query = 'SELECT ' . $category_rel_period_alias . '. * ,' . $category_alias . '. * ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerCategoryRelPeriod :: get_table_name()) . ' AS ' . $category_rel_period_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerCategory :: get_table_name()) . ' AS ' . $category_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategory :: PROPERTY_ID, $category_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerCategoryRelPeriod :: PROPERTY_CATEGORY_ID, $category_rel_period_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerPeriod :: get_table_name()) . ' AS ' . $period_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerCategoryRelPeriod :: PROPERTY_PERIOD_ID, $category_rel_period_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerPeriod :: PROPERTY_ID, $period_alias);
-
- return $this->retrieve_object_set($query, InternshipOrganizerCategoryRelPeriod :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerCategoryRelPeriod :: CLASS_NAME);
-
- }
-
- function retrieve_category_rel_period($category_id, $period_id)
- {
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerCategoryRelPeriod :: PROPERTY_CATEGORY_ID, $category_id);
- $conditions[] = new EqualityCondition(InternshipOrganizerCategoryRelPeriod :: PROPERTY_PERIOD_ID, $period_id);
- $condition = new AndCondition($conditions);
- return $this->retrieve_object(InternshipOrganizerCategoryRelPeriod :: get_table_name(), $condition, array(), InternshipOrganizerCategoryRelPeriod :: CLASS_NAME);
- }
-
- //internship planner moments
-
-
- function create_internship_organizer_moment($moment)
- {
- return $this->create($moment);
- }
-
- function update_internship_organizer_moment($moment)
- {
- $condition = new EqualityCondition(InternshipOrganizerMoment :: PROPERTY_ID, $moment->get_id());
- return $this->update($moment, $condition);
- }
-
- function delete_internship_organizer_moment($moment)
- {
- $condition = new EqualityCondition(InternshipOrganizerMoment :: PROPERTY_ID, $moment->get_id());
- return $this->delete($moment->get_table_name(), $condition);
- }
-
- function count_moments($condition = null)
- {
- return $this->count_objects(InternshipOrganizerMoment :: get_table_name(), $condition);
- }
-
- function retrieve_moment($id)
- {
- $condition = new EqualityCondition(InternshipOrganizerMoment :: PROPERTY_ID, $id);
- return $this->retrieve_object(InternshipOrganizerMoment :: get_table_name(), $condition, array(), InternshipOrganizerMoment :: CLASS_NAME);
- }
-
- function retrieve_moments($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
- return $this->retrieve_objects(InternshipOrganizerMoment :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerMoment :: CLASS_NAME);
- }
-
- function retrieve_moment_rel_users($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
- $moment_alias = $this->get_alias(InternshipOrganizerMoment :: get_table_name());
- $agreement_rel_user_alias = $this->get_alias(InternshipOrganizerAgreementRelUser :: get_table_name());
- $user_alias = UserDataManager :: get_instance()->get_alias(User :: get_table_name());
-
- $query = 'SELECT ' . $moment_alias . '. * ,' . $user_alias . '.lastname , ' . $user_alias . '.firstname , ' . $agreement_rel_user_alias . '. *';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerMoment :: get_table_name()) . ' AS ' . $moment_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerAgreementRelUser :: get_table_name()) . ' AS ' . $agreement_rel_user_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAgreementRelUser :: PROPERTY_AGREEMENT_ID, $agreement_rel_user_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_AGREEMENT_ID, $moment_alias);
-
- $query .= ' JOIN ' . UserDataManager :: get_instance()->escape_table_name(User :: get_table_name()) . ' AS ' . $user_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAgreementRelUser :: PROPERTY_USER_ID, $agreement_rel_user_alias) . ' = ' . $this->escape_column_name(User :: PROPERTY_ID, $user_alias);
-
- return $this->retrieve_object_set($query, InternshipOrganizerMoment :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerMoment :: CLASS_NAME);
- }
-
- function count_moment_rel_users($condition = null)
- {
-
- $moment_alias = $this->get_alias(InternshipOrganizerMoment :: get_table_name());
- $agreement_rel_user_alias = $this->get_alias(InternshipOrganizerAgreementRelUser :: get_table_name());
- $user_alias = UserDataManager :: get_instance()->get_alias(User :: get_table_name());
-
- $query = 'SELECT COUNT(* ) ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerMoment :: get_table_name()) . ' AS ' . $moment_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerAgreementRelUser :: get_table_name()) . ' AS ' . $agreement_rel_user_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAgreementRelUser :: PROPERTY_AGREEMENT_ID, $agreement_rel_user_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_AGREEMENT_ID, $moment_alias);
-
- $query .= ' JOIN ' . UserDataManager :: get_instance()->escape_table_name(User :: get_table_name()) . ' AS ' . $user_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAgreementRelUser :: PROPERTY_USER_ID, $agreement_rel_user_alias) . ' = ' . $this->escape_column_name(User :: PROPERTY_ID, $user_alias);
-
- return $this->count_result_set($query, InternshipOrganizerMoment :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerMoment :: CLASS_NAME);
-
- }
-
- function retrieve_moment_rel_locations($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
-
- $moment_alias = $this->get_alias(InternshipOrganizerMoment :: get_table_name());
- $agreement_alias = $this->get_alias(InternshipOrganizerAgreement :: get_table_name());
- $user_alias = UserDataManager :: get_instance()->get_alias(User :: get_table_name());
- $agreement_rel_locations_alias = $this->get_alias(InternshipOrganizerAgreementRelLocation :: get_table_name());
- $locations_alias = $this->get_alias(InternshipOrganizerLocation :: get_table_name());
- $region_alias = $this->get_alias(InternshipOrganizerRegion :: get_table_name());
- $period_alias = $this->get_alias(InternshipOrganizerPeriod :: get_table_name());
-
- $query = 'SELECT ' . $moment_alias . '.id as moment_id ,' . $moment_alias . '. * ,' . $user_alias . '.lastname , ' . $user_alias . '.firstname , ' . $agreement_alias . '. * , ' . $locations_alias . '. * , ' . $region_alias . '. * , ' . $period_alias . '. * ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerMoment :: get_table_name()) . ' AS ' . $moment_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerAgreement :: get_table_name()) . ' AS ' . $agreement_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAgreement :: PROPERTY_ID, $agreement_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_AGREEMENT_ID, $moment_alias);
-
- $query .= ' JOIN ' . UserDataManager :: get_instance()->escape_table_name(User :: get_table_name()) . ' AS ' . $user_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_OWNER, $moment_alias) . ' = ' . $this->escape_column_name(User :: PROPERTY_ID, $user_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerAgreementRelLocation :: get_table_name()) . ' AS ' . $agreement_rel_locations_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAgreementRelLocation :: PROPERTY_AGREEMENT_ID, $agreement_rel_locations_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_AGREEMENT_ID, $moment_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerLocation :: get_table_name()) . ' AS ' . $locations_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ID, $locations_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerAgreementRelLocation :: PROPERTY_LOCATION_ID, $agreement_rel_locations_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerRegion :: get_table_name()) . ' AS ' . $region_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_ID, $region_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_REGION_ID, $locations_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerPeriod :: get_table_name()) . ' AS ' . $period_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerPeriod :: PROPERTY_ID, $period_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerAgreement :: PROPERTY_PERIOD_ID, $agreement_alias);
-
- return $this->retrieve_object_set($query, InternshipOrganizerMoment :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerMoment :: CLASS_NAME);
- }
-
- function count_moment_rel_locations($condition = null)
- {
-
- $moment_alias = $this->get_alias(InternshipOrganizerMoment :: get_table_name());
- $agreement_alias = $this->get_alias(InternshipOrganizerAgreement :: get_table_name());
- $user_alias = UserDataManager :: get_instance()->get_alias(User :: get_table_name());
- $agreement_rel_locations_alias = $this->get_alias(InternshipOrganizerAgreementRelLocation :: get_table_name());
- $locations_alias = $this->get_alias(InternshipOrganizerLocation :: get_table_name());
- $region_alias = $this->get_alias(InternshipOrganizerRegion :: get_table_name());
- $period_alias = $this->get_alias(InternshipOrganizerPeriod :: get_table_name());
-
- $query = 'SELECT COUNT(DISTINCT ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_ID, $moment_alias) . ')';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerMoment :: get_table_name()) . ' AS ' . $moment_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerAgreement :: get_table_name()) . ' AS ' . $agreement_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAgreement :: PROPERTY_ID, $agreement_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_AGREEMENT_ID, $moment_alias);
-
- $query .= ' JOIN ' . UserDataManager :: get_instance()->escape_table_name(User :: get_table_name()) . ' AS ' . $user_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_OWNER, $moment_alias) . ' = ' . $this->escape_column_name(User :: PROPERTY_ID, $user_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerAgreementRelLocation :: get_table_name()) . ' AS ' . $agreement_rel_locations_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAgreementRelLocation :: PROPERTY_AGREEMENT_ID, $agreement_rel_locations_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_AGREEMENT_ID, $moment_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerLocation :: get_table_name()) . ' AS ' . $locations_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_ID, $locations_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerAgreementRelLocation :: PROPERTY_LOCATION_ID, $agreement_rel_locations_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerRegion :: get_table_name()) . ' AS ' . $region_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerRegion :: PROPERTY_ID, $region_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerLocation :: PROPERTY_REGION_ID, $locations_alias);
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerPeriod :: get_table_name()) . ' AS ' . $period_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerPeriod :: PROPERTY_ID, $period_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerAgreement :: PROPERTY_PERIOD_ID, $agreement_alias);
-
- return $this->count_result_set($query, InternshipOrganizerMoment :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerMoment :: CLASS_NAME);
-
- }
-
- function retrieve_moment_rel_appointments($condition = null, $offset = null, $max_objects = null, $order_by = null)
- {
- $moment_alias = $this->get_alias(InternshipOrganizerMoment :: get_table_name());
- $appointment_alias = $this->get_alias(InternshipOrganizerAppointment :: get_table_name());
-
- $query = 'SELECT ' . $moment_alias . '. * ';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerMoment :: get_table_name()) . ' AS ' . $moment_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerAppointment :: get_table_name()) . ' AS ' . $appointment_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAppointment :: PROPERTY_MOMENT_ID, $appointment_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_ID, $moment_alias);
-
- return $this->retrieve_object_set($query, InternshipOrganizerMoment :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerMoment :: CLASS_NAME);
- }
-
- function count_moment_rel_appointments($condition = null)
- {
-
- $moment_alias = $this->get_alias(InternshipOrganizerMoment :: get_table_name());
- $appointment_alias = $this->get_alias(InternshipOrganizerAppointment :: get_table_name());
-
- $query = 'SELECT COUNT(* ) ';
- $query = 'SELECT ' . $moment_alias . '. * ,';
- $query .= ' FROM ' . $this->escape_table_name(InternshipOrganizerMoment :: get_table_name()) . ' AS ' . $moment_alias;
-
- $query .= ' JOIN ' . $this->escape_table_name(InternshipOrganizerAppointment :: get_table_name()) . ' AS ' . $appointment_alias . ' ON ' . $this->escape_column_name(InternshipOrganizerAppointment :: PROPERTY_MOMENT_ID, $appointment_alias) . ' = ' . $this->escape_column_name(InternshipOrganizerMoment :: PROPERTY_ID, $moment_alias);
-
- return $this->count_result_set($query, InternshipOrganizerMoment :: get_table_name(), $condition, $offset, $max_objects, $order_by, InternshipOrganizerMoment :: CLASS_NAME);
-
- }
-
- //internship planner agreements
-
-
- function create_internship_organizer_agreement($agreement)
- {
- return $this->create($agreement);
- }
-
- function update_internship_organizer_agreement($agreement)
- {
- $condition = new EqualityCondition(InternshipOrganizerAgreement :: PROPERTY_ID, $agreement->get_id());
- return $this->update($agreement, $condition);
- }
-
- function delete_internship_organizer_agreement($agreement)
- {
-
- $agreement_id = $agreement->get_id();
- $condition = new EqualityCondition(InternshipOrganizerMoment :: PROPERTY_AGREEMENT_ID, $agreement_id);
- $moment_count = $this->count_moments($condition);
- if ($moment_count == 0)
- {
- $condition = new EqualityCondition(InternshipOrganizerAgreementRelUser :: PROPERTY_AGREEMENT_ID, $agreement_id);
- $agreement_rel_users = $this->retrieve_agreement_rel_users($condition);
- while ($agreement_rel_user = $agreement_rel_users->next_result())
- {
- $agreement_rel_user->delete();
- }
-
- $condition = new EqualityCondition(InternshipOrganizerAgreementRelLocation :: PROPERTY_AGREEMENT_ID, $agreement_id);
- $agreement_rel_locations = $this->retrieve_agreement_rel_locations($condition);
- while ($agreement_rel_location = $agreement_rel_locations->next_result())
- {
- $agreement_rel_location->delete();
- }
- $condition = new EqualityCondition(InternshipOrganizerAgreementRelMentor :: PROPERTY_AGREEMENT_ID, $agreement_id);
- $agreement_rel_mentors = $this->retrieve_agreement_rel_mentors($condition);
- while ($agreement_rel_mentor = $agreement_rel_mentors->next_result())
- {
- $agreement_rel_mentor->delete();
- }
-
- $conditions = array();
- $conditions[] = new EqualityCondition(InternshipOrganizerPublication :: PROPERTY_PUBLICATION_PLACE, InternshipOrganizerPublicationPlace :: AGREEMENT);
- $conditions[] = new EqualityCondition(InternshipOrganizerPublication :: PROPERTY_PLACE_ID, $agreement_id);
- $condition = new AndCondition($conditions);
-
- $publications = $this->retrieve_publications($condition);
- while ($publication = $publications->ne…
Large files files are truncated, but you can click here to view the full file