Beispiel #1
0
/**
 * This function is called internally by the core whenever the module is
 * loaded.  It adds in the information
 */
function Feeds_tables()
{
    // Initialise table array
    $dbtable = array();

    // Full table definition
    $dbtable['feeds'] = 'feeds';
    $dbtable['feeds_column'] = array('fid'       => 'fid',
                                     'name'      => 'name',
                                     'urltitle'  => 'urltitle',
                                     'url'       => 'url');
    $dbtable['feeds_column_def'] = array('fid'      => 'I(10) NOTNULL AUTOINCREMENT PRIMARY',
                                         'name'     => "C(255) NOTNULL DEFAULT ''",
                                         'urltitle' => "C(255) NOTNULL DEFAULT ''",
                                         'url'      => "C(255) NOTNULL DEFAULT ''");

    // Enable categorization services
    $dbtable['feeds_db_extra_enable_categorization'] = ModUtil::getVar('Feeds', 'enablecategorization');
    $dbtable['feeds_primary_key_column'] = 'fid';

    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition($dbtable['feeds_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($dbtable['feeds_column_def']);

    // Return the table information
    return $dbtable;
}
 /**
  * 创建该类型的实例,并从指定对象或数组上复制属性
  * @param object|array $src 原始对象或数组
  * @return object
  */
 static function create($src)
 {
     $class = new ReflectionClass(get_called_class());
     $target = $class->newInstance();
     ObjectUtil::copyProperties($src, $target);
     return $target;
 }
Beispiel #3
0
/**
 * AddressBook
 *
 * @copyright (c) AddressBook Development Team
 * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
 * @package AddressBook
 */
function AddressBook_tables()
{
    // Initialise table array
    $tables = array();
    $tables['addressbook_address'] = 'addressbook_address';
    $tables['addressbook_address_column'] = array('id' => 'adr_id', 'cat_id' => 'adr_catid', 'prefix' => 'adr_prefix', 'lname' => 'adr_name', 'fname' => 'adr_fname', 'sortname' => 'adr_sortname', 'title' => 'adr_title', 'company' => 'adr_company', 'sortcompany' => 'adr_sortcompany', 'img' => 'adr_img', 'zip' => 'adr_zip', 'city' => 'adr_city', 'address1' => 'adr_address1', 'address2' => 'adr_address2', 'state' => 'adr_state', 'country' => 'adr_country', 'geodata' => 'adr_geodata', 'contact_1' => 'adr_contact_1', 'contact_2' => 'adr_contact_2', 'contact_3' => 'adr_contact_3', 'contact_4' => 'adr_contact_4', 'contact_5' => 'adr_contact_5', 'c_label_1' => 'adr_c_label_1', 'c_label_2' => 'adr_c_label_2', 'c_label_3' => 'adr_c_label_3', 'c_label_4' => 'adr_c_label_4', 'c_label_5' => 'adr_c_label_5', 'c_main' => 'adr_c_main', 'custom_1' => 'adr_custom_1', 'custom_2' => 'adr_custom_2', 'custom_3' => 'adr_custom_3', 'custom_4' => 'adr_custom_4', 'note' => 'adr_note', 'user_id' => 'adr_user', 'private' => 'adr_private', 'date' => 'adr_date', 'counter' => 'adr_counter', 'language' => 'adr_language', 'status' => 'adr_status');
    // Enable categorization services
    $tables['addressbook_address_db_extra_enable_categorization'] = ModUtil::getVar('AddressBook', 'enablecategorization');
    $tables['addressbook_address_primary_key_column'] = 'id';
    ObjectUtil::addStandardFieldsToTableDefinition($tables['addressbook_address_column'], 'adr_');
    // add potential custom_fields
    addCustomFieldsToTableDefinition($tables['addressbook_address_column']);
    $tables['addressbook_address_column_def'] = array('id' => "I AUTO PRIMARY", 'cat_id' => "I  NOTNULL DEFAULT 0", 'prefix' => "I  NOTNULL DEFAULT 0", 'lname' => "C(100) DEFAULT NULL", 'fname' => "C(60) DEFAULT NULL", 'sortname' => "C(180) DEFAULT NULL", 'title' => "C(100) DEFAULT NULL", 'company' => "C(100) DEFAULT NULL", 'sortcompany' => "C(100) DEFAULT NULL", 'img' => "C(100) DEFAULT NULL", 'zip' => "C(30) DEFAULT NULL", 'city' => "C(100) DEFAULT NULL", 'address1' => "C(100) DEFAULT NULL", 'address2' => "C(100) DEFAULT NULL", 'state' => "C(60) DEFAULT NULL", 'country' => "C(60) DEFAULT NULL", 'geodata' => "C(180) DEFAULT NULL", 'contact_1' => "C(100) DEFAULT NULL", 'contact_2' => "C(100) DEFAULT NULL", 'contact_3' => "C(100) DEFAULT NULL", 'contact_4' => "C(100) DEFAULT NULL", 'contact_5' => "C(100) DEFAULT NULL", 'c_label_1' => "I2 DEFAULT NULL", 'c_label_2' => "I2 DEFAULT NULL", 'c_label_3' => "I2 DEFAULT NULL", 'c_label_4' => "I2 DEFAULT NULL", 'c_label_5' => "I2 DEFAULT NULL", 'c_main' => "I2 DEFAULT NULL", 'custom_1' => "X DEFAULT NULL", 'custom_2' => "X DEFAULT NULL", 'custom_3' => "X DEFAULT NULL", 'custom_4' => "X DEFAULT NULL", 'note' => "X DEFAULT NULL", 'user_id' => "I DEFAULT NULL", 'private' => "I2 DEFAULT NULL", 'date' => "I  NOTNULL DEFAULT 0", 'counter' => "I  NOTNULL DEFAULT 0", 'language' => "C(30) NOTNULL DEFAULT ''", 'status' => "I1 DEFAULT '1'");
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['addressbook_address_column_def'], 'adr_');
    $tables['addressbook_labels'] = 'addressbook_labels';
    $tables['addressbook_labels_column'] = array('id' => 'lab_id', 'name' => 'lab_name', 'name1' => 'lab_name1');
    $tables['addressbook_labels_primary_key_column'] = 'id';
    ObjectUtil::addStandardFieldsToTableDefinition($tables['addressbook_labels_column'], 'lab_');
    $tables['addressbook_labels_column_def'] = array('id' => "I AUTO PRIMARY", 'name' => "C(30) DEFAULT NULL", 'name1' => "C(30) DEFAULT NULL");
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['addressbook_labels_column_def'], 'lab_');
    $tables['addressbook_customfields'] = 'addressbook_customfields';
    $tables['addressbook_customfields_column'] = array('id' => 'cus_id', 'name' => 'cus_name', 'name1' => 'cus_name1', 'type' => 'cus_type', 'position' => 'cus_pos', 'option' => 'cus_option');
    $tables['addressbook_customfields_primary_key_column'] = 'id';
    ObjectUtil::addStandardFieldsToTableDefinition($tables['addressbook_customfields_column'], 'cus_');
    $tables['addressbook_customfields_column_def'] = array('id' => "I AUTO PRIMARY", 'name' => "C(30) DEFAULT NULL", 'name1' => "C(30) DEFAULT NULL", 'type' => "C(30) DEFAULT NULL", 'position' => "I NOTNULL DEFAULT 0", 'option' => "X DEFAULT NULL");
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['addressbook_customfields_column_def'], 'cus_');
    $tables['addressbook_favourites'] = 'addressbook_favourites';
    $tables['addressbook_favourites_column'] = array('favadr_id' => 'fav_adr_id', 'favuser_id' => 'fav_user_id');
    $tables['addressbook_favourites_column_def'] = array('favadr_id' => "I NOTNULL DEFAULT 0", 'favuser_id' => "I NOTNULL DEFAULT 0");
    // Return the table information
    return $tables;
}
 protected function doExecute()
 {
     $id = $this->get('_id');
     $rule = Rule::findById($id);
     if ($rule) {
         $ruleCondition = RuleCondition::create($this->get('ruleCondition'));
         $exists = false;
         if ($ruleCondition->condId) {
             if (is_array($rule->conditions)) {
                 foreach ($rule->conditions as $key => $rc) {
                     if ($rc->condId == $ruleCondition->condId) {
                         $exists = true;
                         $rule->conditions[$key] = $ruleCondition;
                         break;
                     }
                 }
             }
         } else {
             $ruleCondition->condId = ObjectUtil::guid();
         }
         if (!$exists) {
             $rule->conditions[] = $ruleCondition;
         }
         $ret = $rule->save();
         if ($ret) {
             return $this->success($ret);
         } else {
             return $this->error(ErrorInfo::ERROR_NO_DB_OPERATION_ERROR, 'add ruleCondition failed');
         }
     } else {
         return $this->error(ErrorInfo::ERROR_NO_DATA_NOT_FOUND, 'rule not found for _id=' . $id);
     }
 }
Beispiel #5
0
/**
 * Define module tables
 * @author Albert Pérez Monfort (intraweb@xtec.cat)
 * @return module tables information
 */
function IWwebbox_tables() {
    // Initialise table array
    $table = array();

    // IWwebbox table definition
    $table['IWwebbox'] = DBUtil::getLimitedTablename('IWwebbox');
    $table['IWwebbox_column'] = array('pid' => 'iw_pid',
                                      'url' => 'iw_url',
                                      'ref' => 'iw_ref',
                                      'scrolls' => 'iw_scrolls',
                                      'description' => 'iw_description',
                                      'width' => 'iw_width',
                                      'height' => 'iw_height',
                                      'widthunit' => 'iw_widthunit');

    $table['IWwebbox_column_def'] = array('pid' => "I NOTNULL AUTO PRIMARY",
                                          'url' => "C(255) NOTNULL DEFAULT ''",
                                          'ref' => "C(10) NOTNULL DEFAULT ''",
                                          'scrolls' => "I(1) NOTNULL DEFAULT '1'",
                                          'description' => "C(255) NOTNULL DEFAULT ''",
                                          'width' => "I NOTNULL DEFAULT '100'",
                                          'height' => "I NOTNULL DEFAULT '600'",
                                          'widthunit' => "C(10) NOTNULL DEFAULT '%'");

    ObjectUtil::addStandardFieldsToTableDefinition($table['IWwebbox_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($table['IWwebbox_column_def'], 'iw_');

    // Return the table information
    return $table;
}
Beispiel #6
0
/**
 * Content
 *
 * @copyright (C) 2007-2010, Content Development Team
 * @link http://github.com/zikula-modules/Content
 * @license See license.txt
 */
function content_tables()
{
    $tables = array();
    // Page setup (pages can be nested beneath each other)
    $tables['content_page'] = 'content_page';
    $tables['content_page_column'] = array('id' => 'page_id', 'parentPageId' => 'page_ppid', 'title' => 'page_title', 'showTitle' => 'page_showtitle', 'urlname' => 'page_urlname', 'metadescription' => 'page_metadescription', 'metakeywords' => 'page_metakeywords', 'nohooks' => 'page_nohooks', 'layout' => 'page_layout', 'categoryId' => 'page_categoryid', 'views' => 'page_views', 'active' => 'page_active', 'activeFrom' => 'page_activefrom', 'activeTo' => 'page_activeto', 'inMenu' => 'page_inmenu', 'position' => 'page_pos', 'level' => 'page_level', 'setLeft' => 'page_setleft', 'setRight' => 'page_setright', 'language' => 'page_language', 'optionalString1' => 'page_optString1', 'optionalString2' => 'page_optString2', 'optionalText' => 'page_optText');
    $tables['content_page_column_def'] = array('id' => "I NOTNULL AUTO PRIMARY", 'parentPageId' => "I NOTNULL DEFAULT 0", 'title' => "C(255) NOTNULL DEFAULT ''", 'showTitle' => "I1 NOTNULL DEFAULT 1", 'urlname' => "C(255) NOTNULL DEFAULT ''", 'metadescription' => "X NOTNULL DEFAULT ''", 'metakeywords' => "X NOTNULL DEFAULT ''", 'nohooks' => "I1 NOTNULL DEFAULT 0", 'layout' => "C(100) NOTNULL", 'categoryId' => "I NOT NULL DEFAULT 0", 'views' => "I NOT NULL DEFAULT 0", 'active' => "I1 NOTNULL DEFAULT 1", 'activeFrom' => "T", 'activeTo' => "T", 'inMenu' => "I1 NOTNULL DEFAULT 1", 'position' => 'I NOTNULL DEFAULT 0', 'level' => 'I NOTNULL DEFAULT 0', 'setLeft' => 'I NOTNULL DEFAULT 0', 'setRight' => 'I NOTNULL DEFAULT 0', 'language' => 'C(10)', 'optionalString1' => "C(255) NOTNULL DEFAULT ''", 'optionalString2' => "C(255) NOTNULL DEFAULT ''", 'optionalText' => "X NOTNULL DEFAULT ''");
    $tables['content_page_primary_key_column'] = 'id';
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition($tables['content_page_column'], 'page_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['content_page_column_def']);
    // additional indexes
    $tables['content_page_column_idx'] = array('parentPageId' => array('parentPageId', 'position'), 'leftright' => array('setLeft', 'setRight'), 'categoryId' => 'categoryId', 'urlname' => array('urlname', 'parentPageId'));
    // Content setup (multiple content items on each page)
    $tables['content_content'] = 'content_content';
    $tables['content_content_column'] = array('id' => 'con_id', 'pageId' => 'con_pageid', 'areaIndex' => 'con_areaindex', 'position' => 'con_position', 'module' => 'con_module', 'type' => 'con_type', 'data' => 'con_data', 'active' => 'con_active', 'visiblefor' => 'con_visiblefor', 'stylePosition' => 'con_stylepos', 'styleWidth' => 'con_stylewidth', 'styleClass' => 'con_styleclass');
    $tables['content_content_column_def'] = array('id' => "I NOTNULL AUTO PRIMARY", 'pageId' => "I NOTNULL DEFAULT 0", 'areaIndex' => "I NOTNULL DEFAULT 0", 'position' => "I NOTNULL DEFAULT 0", 'module' => "C(100) NOTNULL DEFAULT ''", 'type' => "C(100) NOTNULL DEFAULT ''", 'data' => "XL", 'active' => "I1 NOTNULL DEFAULT 1", 'visiblefor' => "I1 NOTNULL DEFAULT 1", 'stylePosition' => "C(20) NOTNULL DEFAULT 'none'", 'styleWidth' => "C(20) NOTNULL DEFAULT 'wauto'", 'styleClass' => "C(100) NOTNULL DEFAULT ''");
    $tables['content_content_primary_key_column'] = 'id';
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition($tables['content_content_column'], 'con_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['content_content_column_def']);
    // additional indexes
    $tables['content_content_column_idx'] = array('pageActive' => array('pageId', 'active'), 'pagePosition' => array('pageId', 'areaIndex', 'position'));
    // Multiple category relation
    $tables['content_pagecategory'] = 'content_pagecategory';
    $tables['content_pagecategory_column'] = array('pageId' => 'con_pageid', 'categoryId' => 'con_categoryid');
    $tables['content_pagecategory_column_def'] = array('pageId' => 'I NOTNULL DEFAULT 0', 'categoryId' => 'I NOTNULL DEFAULT 0');
    // additional indexes
    $tables['content_pagecategory_column_idx'] = array('pageId' => 'pageId');
    // Searchable text from content plugins
    $tables['content_searchable'] = 'content_searchable';
    $tables['content_searchable_column'] = array('searchableId' => 'search_sid', 'contentId' => 'search_cid', 'text' => 'search_text', 'language' => 'search_language');
    $tables['content_searchable_column_def'] = array('searchableId' => 'I NOTNULL AUTO PRIMARY', 'contentId' => 'I NOTNULL DEFAULT 0', 'text' => 'X', 'language' => 'C(10) NOTNULL');
    $tables['content_searchable_primary_key_column'] = 'searchableId';
    // Translated pages
    $tables['content_translatedpage'] = 'content_translatedpage';
    $tables['content_translatedpage_column'] = array('pageId' => 'transp_pid', 'language' => 'transp_lang', 'title' => 'transp_title', 'metadescription' => 'transp_metadescription', 'metakeywords' => 'transp_metakeywords');
    $tables['content_translatedpage_column_def'] = array('pageId' => 'I NOTNULL DEFAULT 0', 'language' => 'C(10) NOTNULL', 'title' => 'C(255) NOTNULL', 'metadescription' => "X NOTNULL DEFAULT ''", 'metakeywords' => "X NOTNULL DEFAULT ''");
    ObjectUtil::addStandardFieldsToTableDefinition($tables['content_translatedpage_column'], 'transp_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['content_translatedpage_column_def']);
    // additional indexes
    $tables['content_translatedpage_column_idx'] = array('entry' => array('pageId', 'language'));
    // Translated content plugins
    $tables['content_translatedcontent'] = 'content_translatedcontent';
    $tables['content_translatedcontent_column'] = array('contentId' => 'transc_cid', 'language' => 'transc_lang', 'data' => 'transc_data');
    $tables['content_translatedcontent_column_def'] = array('contentId' => 'I NOTNULL DEFAULT 0', 'language' => 'C(10) NOTNULL', 'data' => 'XL');
    ObjectUtil::addStandardFieldsToTableDefinition($tables['content_translatedcontent_column'], 'transc_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['content_translatedcontent_column_def']);
    // additional indexes
    $tables['content_translatedcontent_column_idx'] = array('entry' => array('contentId', 'language'));
    // History
    $tables['content_history'] = 'content_history';
    $tables['content_history_column'] = array('id' => 'ch_id', 'pageId' => 'ch_pageid', 'data' => 'ch_data', 'revisionNo' => 'ch_revisionno', 'action' => 'ch_action', 'date' => 'ch_date', 'ipno' => 'ch_ipno', 'userId' => 'ch_userid');
    $tables['content_history_column_def'] = array('id' => "I NOTNULL AUTO PRIMARY", 'pageId' => "I NOTNULL DEFAULT 0", 'data' => "XL NOTNULL DEFAULT ''", 'revisionNo' => "I NOTNULL DEFAULT 0", 'action' => "C(255) NOTNULL DEFAULT ''", 'date' => "T NOTNULL DEFAULT ''", 'ipno' => "C(30) NOTNULL DEFAULT ''", 'userId' => "I NOTNULL DEFAULT 0");
    // additional indexes
    $tables['content_history_column_idx'] = array('entry' => array('pageId', 'revisionNo'), 'action' => 'action');
    return $tables;
}
Beispiel #7
0
 function checkResult(&$item)
 {
     $ok = (SecurityUtil::checkPermission('News::', "$item[cr_uid]::$item[sid]", ACCESS_OVERVIEW));
     if ($this->enablecategorization && $this->enablecategorybasedpermissions) {
         ObjectUtil::expandObjectWithCategories($item, 'news', 'sid');
         $ok = $ok && CategoryUtil::hasCategoryAccess($item['__CATEGORIES__'], 'News');
     }
     return $ok;
 }
Beispiel #8
0
 function checkResult(&$item)
 {
     $ok = SecurityUtil::checkPermission('Pages::', "$item[title]::$item[pageid]", ACCESS_OVERVIEW);
     if ($this->enablecategorization)
     {
         ObjectUtil::expandObjectWithCategories($item, 'pages', 'pageid');
         $ok = $ok && CategoryUtil::hasCategoryAccess($item['__CATEGORIES__'], 'Pages');
     }
     return $ok;
 }
Beispiel #9
0
/**
 * pages table information
*/
function Pages_tables()
{
    // Initialise table array
    $table = array();

    // Full table definition
    $table['pages'] = 'pages';
    $table['pages_column'] = array ('pageid'         => 'pageid',
                                      'title'          => 'title',
                                      'metadescription'   => 'metadescription',
                                      'metakeywords'      => 'metakeywords',
                                      'urltitle'       => 'urltitle',
                                      'content'        => 'content',
                                      'counter'        => 'counter',
                                      'displaywrapper' => 'displaywrapper',
                                      'displaytitle'   => 'displaytitle',
                                      'displaycreated' => 'displaycreated',
                                      'displayupdated' => 'displayupdated',
                                      'displaytextinfo' => 'displaytextinfo',
                                      'displayprint'   => 'displayprint',
                                      'language'       => 'language');
    $table['pages_column_def'] = array('pageid'         => 'I AUTOINCREMENT PRIMARY',
                                         'title'          => "X NOTNULL DEFAULT ''",
                                         'metadescription'   => "X NOTNULL DEFAULT ''",
                                         'metakeywords'      => "X NOTNULL DEFAULT ''",
                                         'urltitle'       => "X NOTNULL DEFAULT ''",
                                         'content'        => "X NOTNULL DEFAULT ''",
                                         'counter'        => "I NOTNULL DEFAULT '0'",
                                         'displaywrapper' => "I1 NOTNULL DEFAULT '1'",
                                         'displaytitle'   => "I1 NOTNULL DEFAULT '1'",
                                         'displaycreated' => "I1 NOTNULL DEFAULT '1'",
                                         'displayupdated' => "I1 NOTNULL DEFAULT '1'",
                                         'displaytextinfo' => "I1 NOTNULL DEFAULT '1'",
                                         'displayprint'   => "I1 NOTNULL DEFAULT '1'",
                                         'language'       => "C(30) NOTNULL DEFAULT ''");

    // Enable categorization services
    $table['pages_db_extra_enable_categorization'] = ModUtil::getVar('Pages', 'enablecategorization');
    $table['pages_primary_key_column'] = 'pageid';

    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition($table['pages_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($table['pages_column_def']);

    // old tables for upgrade/renaming purposes
    $table['seccont']  = DBUtil::getLimitedTablename('seccont');
    $table['sections'] = DBUtil::getLimitedTablename('sections');

    return $table;
}
Beispiel #10
0
/**
 * Define module tables
 * @author Albert Pérez Monfort (aperezm@xtec.cat)
 * @return module tables information
 */
function IWmessages_tables() {
    // Initialise table array
    $table = array();

    // iw_noteboard table definition
    $table['IWmessages'] = DBUtil::getLimitedTablename('IWmessages');
    $table['IWmessages_column'] = array('msg_id' => 'iw_msg_id',
        'msg_image' => 'iw_msg_image',
        'subject' => 'iw_subject',
        'from_userid' => 'iw_from_userid',
        'to_userid' => 'iw_to_userid',
        'msg_time' => 'iw_msg_time',
        'msg_readtime' => 'iw_msg_readtime',
        'msg_text' => 'iw_msg_text',
        'read_msg' => 'iw_read_msg',
        'del_msg_to' => 'iw_del_msg_to',
        'del_msg_from' => 'iw_del_msg_from',
        'marcat' => 'iw_marcat',
        'reply' => 'iw_reply',
        'file1' => 'iw_file1',
        'file2' => 'iw_file2',
        'file3' => 'iw_file3',
        'replied' => 'iw_replied');

    $table['IWmessages_column_def'] = array('msg_id' => "I NOTNULL AUTO PRIMARY",
        'msg_image' => "C(100) NOTNULL DEFAULT ''",
        'subject' => "C(100) NOTNULL DEFAULT ''",
        'from_userid' => "I(10) NOTNULL DEFAULT '0'",
        'to_userid' => "I(10) NOTNULL DEFAULT '0'",
        'msg_time' => "C(20) NOTNULL DEFAULT ''",
        'msg_readtime' => "C(20) NOTNULL DEFAULT ''",
        'msg_text' => "X NOTNULL",
        'read_msg' => "I(4) NOTNULL DEFAULT '0'",
        'del_msg_to' => "I(4) NOTNULL DEFAULT '0'",
        'del_msg_from' => "I(4) NOTNULL DEFAULT '0'",
        'marcat' => "I(1) NOTNULL DEFAULT '0'",
        'reply' => "X NOTNULL",
        'file1' => "C(100) NOTNULL DEFAULT ''",
        'file2' => "C(100) NOTNULL DEFAULT ''",
        'file3' => "C(100) NOTNULL DEFAULT ''",
        'replied' => "I(1) NOTNULL DEFAULT '0'");

    ObjectUtil::addStandardFieldsToTableDefinition($table['IWmessages_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($table['IWmessages_column_def'], 'iw_');

    // Return the table information
    return $table;
}
Beispiel #11
0
/**
 * Define module tables
 * @author Albert Pérez Monfort (aperezm@xtec.cat)
 * @return module tables information
 */
function IWvhmenu_tables() {
    // Initialise table array
    $table = array();

    // iw_main table definition
    $table['IWvhmenu'] = DBUtil::getLimitedTablename('IWvhmenu');

    //Noms dels camps
    $table['IWvhmenu_column'] = array('mid' => 'iw_mid',
        'text' => 'iw_text',
        'url' => 'iw_url',
        'bg_image' => 'iw_bg_image',
        'height' => 'iw_height',
        'width' => 'iw_width',
        'id_parent' => 'iw_id_parent',
        'groups' => 'iw_groups',
        'active' => 'iw_active',
        'target' => 'iw_target',
        'descriu' => 'iw_descriu',
        'iorder' => 'iw_iorder',
        'grafic' => 'iw_grafic',
        'image1' => 'iw_image1',
        'image2' => 'iw_image2');

    $table['IWvhmenu_column_def'] = array('mid' => "I NOTNULL AUTO PRIMARY",
        'text' => "C(50) NOTNULL DEFAULT ''",
        'url' => "C(255) NOTNULL DEFAULT ''",
        'bg_image' => "C(20) NOTNULL DEFAULT ''",
        'height' => "I(3) NOTNULL DEFAULT '25'",
        'width' => "I(3) NOTNULL DEFAULT '125'",
        'id_parent' => "INT(11) NOTNULL DEFAULT '0'",
        'groups' => "X NOTNULL",
        'active' => "I(1) NOTNULL DEFAULT '0'",
        'target' => "I(1) NOTNULL DEFAULT '0'",
        'descriu' => "X NOTNULL",
        'iorder' => "I NOTNULL DEFAULT '0'",
        'grafic' => "I(1) NOTNULL DEFAULT '0'",
        'image1' => "C(20) NOTNULL DEFAULT ''",
        'image2' => "C(20) NOTNULL DEFAULT ''");

    ObjectUtil::addStandardFieldsToTableDefinition($table['IWvhmenu_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($table['IWvhmenu_column_def'], 'iw_');


    // Return the table information
    return $table;
}
Beispiel #12
0
/**
 * Zikula Application Framework
 * @copyright  (c) Zikula Development Team
 * @license    GNU/GPL
 *
 * Get Ephemerides table array
 * @return       array with table information.
*/
function Ephemerides_tables()
{
    // initialise table array
    $tables = array();
    // full table definition
    $tables['ephem'] = 'ephem';
    $tables['ephem_column'] = array('eid' => 'eid', 'did' => 'did', 'mid' => 'mid', 'yid' => 'yid', 'content' => 'content', 'language' => 'language', 'status' => 'status', 'type' => 'type');
    $tables['ephem_column_def'] = array('eid' => 'I NOTNULL AUTO PRIMARY', 'did' => "I1 NOTNULL DEFAULT '0'", 'mid' => "I1 NOTNULL DEFAULT '0'", 'yid' => "I2 NOTNULL DEFAULT '0'", 'content' => 'X NOTNULL', 'language' => "C(30) NOTNULL DEFAULT ''", 'status' => "I1 DEFAULT '1'", 'type' => "I1 DEFAULT '1'");
    // enable categorization services
    $tables['ephem_db_extra_enable_categorization'] = ModUtil::getVar('Ephemerides', 'enablecategorization', true);
    $tables['ephem_primary_key_column'] = 'eid';
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition($tables['ephem_column'], '');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['ephem_column_def']);
    // return table information
    return $tables;
}
Beispiel #13
0
/**
 * Zikula Application Framework
 * @copyright  (c) Zikula Development Team
 * @license    GNU/GPL
 *
 * Get Quotes table array
 * @return       array with table information.
*/
function Quotes_tables()
{
    // initialise table array
    $tables = array();
    // full table definition
    $tables['quotes'] = 'quotes';
    $tables['quotes_column'] = array('qid' => 'qid', 'quote' => 'quote', 'author' => 'author', 'status' => 'status');
    $tables['quotes_column_def'] = array('qid' => 'I4 NOTNULL AUTO PRIMARY', 'quote' => 'X', 'author' => 'C(150) NOTNULL', 'status' => "I1 DEFAULT '1'");
    // enable categorization services
    $tables['quotes_db_extra_enable_categorization'] = ModUtil::getVar('Quotes', 'enablecategorization', true);
    $tables['quotes_primary_key_column'] = 'qid';
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition($tables['quotes_column'], '');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['quotes_column_def']);
    // return table information
    return $tables;
}
Beispiel #14
0
/**
 * Populate tables array for Categories module.
 *
 * @return array Array of informations related to the Categories module tables.
 */
function ZikulaCategoriesModule_tables()
{
    // Initialise table array
    $dbtable = array();
    $table = 'categories_category';
    $dbtable['categories_category'] = $table;
    $columns = array('id' => 'id', 'parent_id' => 'parent_id', 'is_locked' => 'is_locked', 'is_leaf' => 'is_leaf', 'name' => 'name', 'value' => 'value', 'sort_value' => 'sort_value', 'display_name' => 'display_name', 'display_desc' => 'display_desc', 'path' => 'path', 'ipath' => 'ipath', 'status' => 'status');
    ObjectUtil::addStandardFieldsToTableDefinition($columns);
    $dbtable['categories_category_column'] = $columns;
    // Enable attribution services
    $dbtable['categories_category_db_extra_enable_attribution'] = true;
    $pathType = 'X';
    $dbType = strtolower(Doctrine_Manager::getInstance()->getCurrentConnection()->getDriverName());
    // mssql can't sort on fields of type text
    if ($dbType == 'mssql') {
        $pathType = 'C(8000)';
    }
    $tabledef = array('id' => 'I4 NOTNULL PRIMARY AUTO', 'parent_id' => 'I4 NOTNULL DEFAULT 1', 'is_locked' => 'I1 NOTNULL DEFAULT 0', 'is_leaf' => 'I1 NOTNULL DEFAULT 0', 'name' => "C(255) NOTNULL DEFAULT ''", 'value' => "C(255) NOTNULL DEFAULT ''", 'sort_value' => 'I4 NOTNULL DEFAULT 2147483647', 'display_name' => "X NOTNULL DEFAULT ''", 'display_desc' => "X NOTNULL DEFAULT ''", 'path' => "{$pathType} NOTNULL DEFAULT ''", 'ipath' => "C(255) NOTNULL DEFAULT ''", 'status' => "C(1) NOTNULL DEFAULT 'A'");
    ObjectUtil::addStandardFieldsToTableDataDefinition($tabledef);
    $dbtable['categories_category_column_def'] = $tabledef;
    $table = 'categories_mapmeta';
    $dbtable['categories_mapmeta'] = $table;
    $columns = array('id' => 'id', 'meta_id' => 'meta_id', 'category_id' => 'category_id');
    ObjectUtil::addStandardFieldsToTableDefinition($columns);
    $dbtable['categories_mapmeta_column'] = $columns;
    $tabledef = array('id' => 'I4 PRIMARY AUTO', 'meta_id' => 'I4 NOTNULL DEFAULT 0', 'category_id' => 'I4  NOTNULL DEFAULT 0');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tabledef);
    $dbtable['categories_mapmeta_column_def'] = $tabledef;
    $table = 'categories_mapobj';
    $dbtable['categories_mapobj'] = $table;
    $columns = array('id' => 'id', 'modname' => 'modname', 'table' => 'tablename', 'obj_id' => 'obj_id', 'obj_idcolumn' => 'obj_idcolumn', 'reg_id' => 'reg_id', 'reg_property' => 'reg_property', 'category_id' => 'category_id');
    ObjectUtil::addStandardFieldsToTableDefinition($columns);
    $dbtable['categories_mapobj_column'] = $columns;
    $tabledef = array('id' => 'I4 PRIMARY AUTO', 'modname' => "C(60) NOTNULL DEFAULT ''", 'table' => "C(60) NOTNULL DEAULT ''", 'obj_id' => 'I4 NOTNULL DEFAULT 0', 'obj_idcolumn' => "C(60) NOTNULL DEFAULT 'id'", 'reg_id' => 'I4 NOTNULL DEFAULT 0', 'reg_property' => "C(60) NOTNULL DEFAULT ''", 'category_id' => 'I4 NOTNULL DEFAULT 0');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tabledef);
    $dbtable['categories_mapobj_column_def'] = $tabledef;
    $table = 'categories_registry';
    $dbtable['categories_registry'] = $table;
    $columns = array('id' => 'id', 'modname' => 'modname', 'table' => 'entityname', 'property' => 'property', 'category_id' => 'category_id');
    ObjectUtil::addStandardFieldsToTableDefinition($columns);
    $dbtable['categories_registry_column'] = $columns;
    $tabledef = array('id' => 'I4 PRIMARY AUTO', 'modname' => "C(60) NOTNULL DEFAULT ''", 'table' => "C(60) NOTNULL DEFAULT ''", 'property' => "C(60) NOTNULL DEFAULT ''", 'category_id' => 'I4 NOTNULL DEFAULT 0');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tabledef);
    $dbtable['categories_registry_column_def'] = $tabledef;
    return $dbtable;
}
Beispiel #15
0
 /**
  * Delete Ephemeride
  * @author The Zikula Development Team
  * @param 'eid' the id of the ephemerid
  * @return true if success, false otherwise
  */
 public function delete($args)
 {
     // argument check
     if (!isset($args['eid']) || !is_numeric($args['eid'])) {
         return LogUtil::registerArgsError();
     }
     // get the existing item
     $item = ModUtil::apiFunc('Ephemerides', 'user', 'get', array('eid' => $args['eid']));
     if (!$item) {
         return LogUtil::registerError($this->__('No such Ephemeride found.'));
     }
     // delete the item and check the return value for error
     $res = DBUtil::deleteObjectByID('ephem', $args['eid'], 'eid');
     if (!$res) {
         return LogUtil::registerError($this->__('Error! Ephemeride deletion failed.'));
     }
     // delete any object category mappings for this item
     ObjectUtil::deleteObjectCategories($item, 'ephem', 'eid');
     return true;
 }
 private function saveRule()
 {
     $data = array('url' => '/add', 'res' => array('errno' => '0', 'data' => array('name' => 'hehe')));
     $rc1 = new RuleCondition();
     $rc1->condId = ObjectUtil::guid();
     $rc1->logicType = RuleCondition::LOGIC_TYPE_AND;
     $rce1 = new RuleConditionExpression();
     $rce1->contextType = RuleConditionExpressionOperand::CONTEXT_TYPE_REQUEST;
     $rce1->key = 'name';
     $rce1->value = 'Lily';
     $rce1->operator = RuleConditionExpression::OPERATOR_EQUAL;
     $rce2 = new RuleConditionExpression();
     $rce2->contextType = RuleConditionExpressionOperand::CONTEXT_TYPE_REQUEST;
     $rce2->key = 'age';
     $rce2->value = 10;
     $rce2->operator = RuleConditionExpression::OPERATOR_GRATER;
     $rc1->expressions = array($rce1, $rce2);
     $rc2 = new RuleCondition();
     $rc2->condId = ObjectUtil::guid();
     $rc2->logicType = RuleCondition::LOGIC_TYPE_OR;
     $rce3 = new RuleConditionExpression();
     $rce3->contextType = RuleConditionExpressionOperand::CONTEXT_TYPE_HEADER;
     $rce3->key = 'WITH_XML_HTTP_REQUEST';
     $rce3->operator = RuleConditionExpression::OPERATOR_IS_SET;
     $rce4 = new RuleConditionExpression();
     $rce4->contextType = RuleConditionExpressionOperand::CONTEXT_TYPE_REQUEST;
     $rce4->key = 'agent';
     $rce4->value = "MSIE";
     $rce4->operator = RuleConditionExpression::OPERATOR_NOT_CONTAIN;
     $rc2->expressions = array($rce3, $rce4);
     $data['conditions'] = array($rc1, $rc2);
     $rule = Rule::create($data);
     //        return $this->success($rule);
     $ret = $rule->save();
     if ($ret) {
         return $this->success($ret);
     } else {
         return $this->error(ErrorInfo::ERROR_NO_DB_OPERATION_ERROR, 'save failed');
     }
 }
Beispiel #17
0
/**
 * Populate dbtables array for settings module.
 *
 * @return array dbtables array.
 */
function ZikulaSettingsModule_tables()
{
    // Initialise table array
    $dbtables = array();
    $table = 'objectdata_attributes';
    $dbtables['objectdata_attributes'] = $table;
    $columns = array('id' => 'id', 'attribute_name' => 'attribute_name', 'object_id' => 'object_id', 'object_type' => 'object_type', 'value' => 'value');
    ObjectUtil::addStandardFieldsToTableDefinition($columns);
    $dbtables['objectdata_attributes_column'] = $columns;
    $dbtables['objectdata_attributes_column_idx'] = array('object_type' => 'object_type', 'object_id' => 'object_id');
    $tabledef = array('id' => 'I4 PRIMARY AUTO', 'attribute_name' => "C(80) NOTNULL DEFAULT ''", 'object_id' => 'I4 NOTNULL DEFAULT 0', 'object_type' => "C(80) NOTNULL DEFAULT ''", 'value' => "X NOTNULL DEFAULT ''");
    ObjectUtil::addStandardFieldsToTableDataDefinition($tabledef);
    $dbtables['objectdata_attributes_column_def'] = $tabledef;
    $table = 'objectdata_log';
    $dbtables['objectdata_log'] = $table;
    $columns = array('id' => 'id', 'object_type' => 'object_type', 'object_id' => 'object_id', 'op' => 'op', 'diff' => 'diff');
    ObjectUtil::addStandardFieldsToTableDefinition($columns);
    $dbtables['objectdata_log_column'] = $columns;
    $tabledef = array('id' => 'I4 PRIMARY AUTO', 'object_type' => "C(80) NOTNULL DEFAULT ''", 'object_id' => 'I4 NOTNULL DEFAULT 0', 'op' => "C(16) NOTNULL DEFAULT ''", 'diff' => "X NOT NULL DEFAULT ''");
    ObjectUtil::addStandardFieldsToTableDataDefinition($tabledef, 'obl_');
    $dbtables['objectdata_log_column_def'] = $tabledef;
    $table = 'objectdata_meta';
    $dbtables['objectdata_meta'] = $table;
    $columns = array('id' => 'id', 'module' => 'module', 'table' => 'tablename', 'idcolumn' => 'idcolumn', 'obj_id' => 'obj_id', 'permissions' => 'permissions', 'dc_title' => 'dc_title', 'dc_author' => 'dc_author', 'dc_subject' => 'dc_subject', 'dc_keywords' => 'dc_keywords', 'dc_description' => 'dc_description', 'dc_publisher' => 'dc_publisher', 'dc_contributor' => 'dc_contributor', 'dc_startdate' => 'dc_startdate', 'dc_enddate' => 'dc_enddate', 'dc_type' => 'dc_type', 'dc_format' => 'dc_format', 'dc_uri' => 'dc_uri', 'dc_source' => 'dc_source', 'dc_language' => 'dc_language', 'dc_relation' => 'dc_relation', 'dc_coverage' => 'dc_coverage', 'dc_entity' => 'dc_entity', 'dc_comment' => 'dc_comment', 'dc_extra' => 'dc_extra');
    ObjectUtil::addStandardFieldsToTableDefinition($columns);
    $dbtables['objectdata_meta_column'] = $columns;
    $tabledef = array('id' => 'I4 PRIMARY AUTO', 'module' => "C(40) NOTNULL DEFAULT ''", 'table' => "C(40) NOTNULL DEFAULT ''", 'idcolumn' => "C(40) NOTNULL DEFAULT ''", 'obj_id' => 'I4 NOTNULL DEFAULT 0', 'permissions' => "C(255) DEFAULT ''", 'dc_title' => "C(80) DEFAULT ''", 'dc_author' => "C(80) DEFAULT ''", 'dc_subject' => "C(255) DEFAULT ''", 'dc_keywords' => "C(128) DEFAULT ''", 'dc_description' => "C(255) DEFAULT ''", 'dc_publisher' => "C(128) DEFAULT ''", 'dc_contributor' => "C(128) DEFAULT ''", 'dc_startdate' => "T DEFAULT '1970-01-01 00:00:00'", 'dc_enddate' => "T DEFAULT '1970-01-01 00:00:00'", 'dc_type' => "C(128) DEFAULT ''", 'dc_format' => "C(128) DEFAULT ''", 'dc_uri' => "C(255) DEFAULT ''", 'dc_source' => "C(128) DEFAULT ''", 'dc_language' => "C(32) DEFAULT ''", 'dc_relation' => "C(255) DEFAULT ''", 'dc_coverage' => "C(64) DEFAULT ''", 'dc_entity' => "C(64) DEFAULT ''", 'dc_comment' => "C(255) DEFAULT ''", 'dc_extra' => "C(255) DEFAULT ''");
    ObjectUtil::addStandardFieldsToTableDataDefinition($tabledef);
    $dbtables['objectdata_meta_column_def'] = $tabledef;
    // workflow
    $dbtables['workflows'] = 'workflows';
    $dbtables['workflows_column'] = array('id' => 'id', 'metaid' => 'metaid', 'module' => 'module', 'schemaname' => 'schemaname', 'state' => 'state', 'type' => 'type', 'obj_table' => 'obj_table', 'obj_idcolumn' => 'obj_idcolumn', 'obj_id' => 'obj_id', 'busy' => 'busy', 'debug' => 'debug');
    $dbtables['workflows_column_def'] = array('id' => 'I NOTNULL AUTO PRIMARY', 'metaid' => 'I NOTNULL DEFAULT 0', 'module' => "C(255) NOTNULL DEFAULT ''", 'schemaname' => "C(255) NOTNULL DEFAULT ''", 'state' => "C(255) NOTNULL DEFAULT ''", 'type' => 'I2 NOTNULL DEFAULT 1', 'obj_table' => "C(40) NOTNULL DEFAULT ''", 'obj_idcolumn' => "C(40) NOTNULL DEFAULT ''", 'obj_id' => 'I4 NOTNULL DEFAULT 0', 'busy' => 'I NOTNULL DEFAULT 0', 'debug' => 'XL');
    // addtitional indexes
    $dbtables['workflows_column_idx'] = array('obj_table' => 'obj_table', 'obj_idcolumn' => 'obj_idcolumn', 'obj_id' => 'obj_id');
    return $dbtables;
}
Beispiel #18
0
/**
 * Define module tables
 * @author Albert P�rez Monfort (aperezm@xtec.cat)
 * @return module tables information
 */
function IWmain_tables() {
    // Initialise table array
    $table = array();

    // IWmain table definition
    $table['IWmain'] = DBUtil::getLimitedTablename('IWmain');
    $table['IWmain_column'] = array('id' => 'iw_id',
        'module' => 'iw_module',
        'name' => 'iw_name',
        'value' => 'iw_value',
        'uid' => 'iw_uid',
        'lifetime' => 'iw_lifetime',
        'nult' => 'iw_nult');

    $table['IWmain_column_def'] = array('id' => "I NOTNULL AUTO PRIMARY",
        'module' => "C(50) NOTNULL DEFAULT ''",
        'name' => "C(50) NOTNULL DEFAULT ''",
        'value' => "X NOTNULL",
        'uid' => "I NOTNULL DEFAULT '0'",
        'lifetime' => "C(20) NOTNULL DEFAULT '0'",
        'nult' => "I(1) NOTNULL DEFAULT '0'");

    ObjectUtil::addStandardFieldsToTableDefinition($table['IWmain_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($table['IWmain_column_def'], 'iw_');

    // logs table definition
    $table['IWmain_logs'] = DBUtil::getLimitedTablename('IWmain_logs');
    $table['IWmain_logs_column'] = array('logId' => 'iw_logId',
        'moduleName' => 'iw_moduleName',
        'actionType' => 'iw_actionType', // 1 - add / 2 - Edit / 3 - Delete
        'visible' => 'iw_visible', // 1 - all users / 0 - only administrators
        'actionText' => 'iw_actionText',
        'logIp' => 'iw_logIp',
        'indexName' => 'iw_indexName',
        'indexValue' => 'iw_indexValue',
        'indexName1' => 'iw_indexName1',
        'indexValue1' => 'iw_indexValue1',
        'error' => 'iw_error',
    );

    $table['IWmain_logs_column_def'] = array('logId' => "I NOTNULL AUTO PRIMARY",
        'moduleName' => "C(25) NOTNULL DEFAULT ''",
        'actionType' => "I(1) NOTNULL DEFAULT '0'",
        'visible' => "I(1) NOTNULL DEFAULT '0'",
        'actionText' => "C(255) NOTNULL DEFAULT ''",
        'logIp' => "C(15) NOTNULL DEFAULT ''",
        'indexName' => "C(15) NOTNULL DEFAULT ''",
        'indexValue' => "I NOTNULL DEFAULT '0'",
        'indexName1' => "C(15) NOTNULL DEFAULT ''",
        'indexValue1' => "I NOTNULL DEFAULT '0'",
        'error' => "I(1) NOTNULL DEFAULT '0'",
    );

    ObjectUtil::addStandardFieldsToTableDefinition($table['IWmain_logs_column'], '');
    ObjectUtil::addStandardFieldsToTableDataDefinition($table['IWmain_logs_column_def']);

    // IWusers table definition
    $table['IWusers'] = DBUtil::getLimitedTablename('IWusers');
    $table['IWusers_column'] = array('suid' => 'iw_suid',
        'uid' => 'iw_uid',
        'id' => 'iw_id',
        'nom' => 'iw_nom',
        'cognom1' => 'iw_cognom1',
        'cognom2' => 'iw_cognom2',
        'naixement' => 'iw_naixement',
	'code' => 'iw_code',
        'accio' => 'iw_accio',
        'sex' => 'iw_sex',
        'description' => 'iw_description',
        'avatar' => 'iw_avatar',
        'newavatar' => 'iw_newavatar',
    );
    // Return the table information
    return $table;
}
Beispiel #19
0
 /**
  * Get the hashcode for this object data array.
  *
  * @param boolean $includeStandardFields Wheter or not to include standard fields to hashcode.
  * @param array   $objData               Object data.
  *
  * @return string Hashcode.
  */
 public function getHash($includeStandardFields = true, $objData = null)
 {
     if (!$objData) {
         $objData = $this->_objData;
     }
     if (!$includeStandardFields) {
         $objData = $this->_objData;
         // copy
         ObjectUtil::removeStandardFieldsFromObject($objData);
     }
     return hash('sha1', serialize($objData));
 }
Beispiel #20
0
    /**
     * get all feeds feeds
     * @return mixed array of items, or false on failure
     */
    public function getall($args)
    {
        // Optional arguments.
        if (!isset($args['startnum']) || !is_numeric($args['startnum'])) {
            $args['startnum'] = 0;
        }
        if (!isset($args['numitems']) || !is_numeric($args['numitems'])) {
            $args['numitems'] = -1;
        }
        if (!isset($args['category'])) {
            $args['category'] = null;
        }

        if (!is_numeric($args['startnum']) ||
                !is_numeric($args['numitems'])) {
            return LogUtil::registerArgsError();
        }

        $items = array();

        // Security check
        if (!SecurityUtil::checkPermission( 'Feeds::', '::', ACCESS_READ)) {
            return $items;
        }

        $args['catFilter'] = array();
        if (isset($args['category']) && !empty($args['category'])){
            if (is_array($args['category'])) {
                $args['catFilter'] = $args['category'];
            } elseif (isset($args['property'])) {
                $property = $args['property'];
                $args['catFilter'][$property] = $args['category'];
            }
            $args['catFilter']['__META__'] = array('module' => 'Feeds');
        }

        // define the permission filter to apply
        $permFilter = array(array('realm'           => 0,
                        'component_left'  => 'Feeds',
                        'component_right' => 'item',
                        'instance_left'   => 'name',
                        'instance_right'  => 'fid',
                        'level'           => ACCESS_READ));

        $orderby = null;
        if (!empty($args['order'])) {
            $dbtable = DBUtil::getTables();
            $feedscolumn = $dbtable['feeds_column'];
            $orderby = $feedscolumn[$args['order']].' DESC';
        }

        // get the objects from the db
        $objArray = DBUtil::selectObjectArray('feeds', '', 'fid', $args['startnum']-1, $args['numitems'], '', $permFilter, $args['catFilter']);

        if ($objArray === false) {
            return LogUtil::registerError(__('Error! Could not load any Feed.'));
        }

        // need to do this here as the category expansion code can't know the
        // root category which we need to build the relative path component
        if ($objArray && isset($args['catregistry']) && $args['catregistry']) {
            ObjectUtil::postProcessExpandedObjectArrayCategories($objArray, $args['catregistry']);
        }

        // Return the items
        return $objArray;
    }
Beispiel #21
0
 /**
  * Selector for a module's tables.
  *
  * @param string  $modname           Module name.
  * @param string  $tablename         Table name.
  * @param string  $name              Select field name.
  * @param string  $selectedValue     Selected value.
  * @param string  $defaultValue      Value for "default" option.
  * @param string  $defaultText       Text for "default" option.
  * @param boolean $submit            Submit on choose.
  * @param boolean $showSystemColumns Whether or not to show the system columns.
  * @param boolean $disabled          Add Disabled attribute to select.
  * @param integer $multipleSize      Size for multiple selects.
  *
  * @return string The rendered output.
  */
 public static function getSelector_TableFields($modname, $tablename, $name, $selectedValue = '', $defaultValue = 0, $defaultText = '', $submit = false, $showSystemColumns = false, $disabled = false, $multipleSize = 1)
 {
     if (!$modname) {
         return z_exit(__f('Invalid %1$s passed to %2$s.', array('modname', 'HtmlUtil::getSelector_TableFields')));
     }
     if (!$tablename) {
         return z_exit(__f('Invalid %1$s passed to %2$s.', array('tablename', 'HtmlUtil::getSelector_TableFields')));
     }
     if (!$name) {
         return z_exit(__f('Invalid %1$s passed to %2$s.', array('name', 'HtmlUtil::getSelector_TableFields')));
     }
     $tables = ModUtil::dbInfoLoad($modname, '', true);
     $colkey = $tablename . '_column';
     $cols = $tables[$colkey];
     if (!$cols) {
         return z_exit(__f('Invalid %1$s [%2$s] in %3$s.', array('column key', $colkey, 'HtmlUtil::getSelector_TableFields')));
     }
     if (!$showSystemColumns) {
         $filtercols = array();
         ObjectUtil::addStandardFieldsToTableDefinition($filtercols, '');
     }
     $data = array();
     foreach ($cols as $k => $v) {
         if ($showSystemColumns) {
             $data[$v] = $k;
         } else {
             if (!$filtercols[$k]) {
                 $data[$v] = $k;
             }
         }
     }
     return self::getSelector_Generic($name, $data, $selectedValue, $defaultValue, $defaultText, $allValue, $allText, $submit, $disabled, $multipleSize);
 }
Beispiel #22
0
 /**
  * Delete all attribtes after an delete.
  *
  * @param Doctrine_Event $event Event.
  *
  * @return void
  */
 public function postDelete(Doctrine_Event $event)
 {
     $data = $event->getInvoker();
     if (!isset($data['__META__'])) {
         return;
     }
     $tableName = $this->getTableNameFromEvent($event);
     $idColumn = $this->getIdColumnFromEvent($event);
     // determine meta id
     if (isset($data['__META__']['id'])) {
         $metaId = $data['__META__']['id'];
     } else {
         $dataForObjectUtil = array();
         $dataForObjectUtil[$idColumn] = $data[$idColumn];
         $dataForObjectUtil['__META__'] = $data['__META__'];
         if ($dataForObjectUtil['__META__'] instanceof ArrayObject) {
             $dataForObjectUtil['__META__'] = $dataForObjectUtil['__META__']->getArrayCopy();
         }
         $meta = ObjectUtil::retrieveObjectMetaData($dataForObjectUtil, $tableName, $idColumn);
         $metaId = $meta['id'];
     }
     $dataForObjectUtil = array();
     $dataForObjectUtil[$idColumn] = $data[$idColumn];
     $dataForObjectUtil['__META__'] = $data['__META__'];
     $dataForObjectUtil['__META__']['id'] = $metaId;
     $dataForObjectUtil['__META__']['obj_id'] = $data[$idColumn];
     if ($dataForObjectUtil['__META__'] instanceof ArrayObject) {
         $dataForObjectUtil['__META__'] = $dataForObjectUtil['__META__']->getArrayCopy();
     }
     ObjectUtil::deleteObjectMetaData($dataForObjectUtil, $tableName, $idColumn);
 }
Beispiel #23
0
/**
 * Define module tables
 * @author Albert Pérez Monfort
 * @return module tables information
 */
function IWdocmanager_tables() {
    // Initialise table array
    $table = array();

    // define downloads table
    $table['IWdocmanager'] = DBUtil::getLimitedTablename('IWdocmanager');
    $table['IWdocmanager_column'] = array('documentId' => 'documentId',
        'documentName' => 'documentName',
        'categoryId' => 'categoryId',
        'fileName' => 'fileName',
        'description' => 'description',
        'filesize' => 'filesize',
        'author' => 'author',
        'nClicks' => 'nClicks',
        'validated' => 'validated',
        'version' => 'version',
        'authorName' => 'authorName',
        'documentLink' => 'documentLink',
        'fileOriginalName' => 'fileOriginalName',
        'versioned' => 'versioned',
        'versionFrom' => 'versionFrom',
    );

    $table['IWdocmanager_column_def'] = array('documentId' => "I NOTNULL AUTO PRIMARY",
        'documentName' => "C(200) NOTNULL DEFAULT ''",
        'categoryId' => "I NOTNULL DEFAULT 0",
        'fileName' => "C(10) NOTNULL DEFAULT ''",
        'description' => "X NOTNULL",
        'filesize' => "C(10) NOTNULL DEFAULT ''",
        'author' => "I NOTNULL DEFAULT 0",
        'nClicks' => "I NOTNULL DEFAULT '0'",
        'validated' => "I(4) NOTNULL DEFAULT '0'",
        'version' => "C(30) NOTNULL DEFAULT ''",
        'authorName' => "C(120) NOTNULL DEFAULT ''",
        'documentLink' => "C(200) NOTNULL DEFAULT ''",
        'fileOriginalName' => "C(100) NOTNULL DEFAULT ''",
        'versioned' => "I NOTNULL DEFAULT '0'",
        'versionFrom' => "C(255) NOTNULL DEFAULT ''",
    );

    ObjectUtil::addStandardFieldsToTableDefinition($table['IWdocmanager_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($table['IWdocmanager_column_def'], 'iw_');

    // define categories table
    $table['IWdocmanager_categories'] = DBUtil::getLimitedTablename('IWdocmanager_categories');
    $table['IWdocmanager_categories_column'] = array('categoryId' => 'categoryId',
        'categoryName' => 'categoryName',
        'description' => 'description',
        'groups' => 'groups',
        'nDocuments' => 'nDocuments',
        'nDocumentsNV' => 'nDocumentsNV',
        'active' => 'active',
        'parentId' => 'parentId',
        'groupsAdd' => 'groupsAdd',
    );

    $table['IWdocmanager_categories_column_def'] = array('categoryId' => "I NOTNULL AUTO PRIMARY",
        'categoryName' => "C(200) NOTNULL DEFAULT ''",
        'description' => "X NOTNULL",
        'groups' => "X NOTNULL DEFAULT ''",
        'nDocuments' => "I NOTNULL DEFAULT '0'",
        'nDocumentsNV' => "I NOTNULL DEFAULT '0'",
        'active' => "I(4) NOTNULL DEFAULT '0'",
        'parentId' => "I NOTNULL DEFAULT '0'",
        'groupsAdd' => "X NOTNULL DEFAULT ''",
    );

    ObjectUtil::addStandardFieldsToTableDefinition($table['IWdocmanager_categories_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($table['IWdocmanager_categories_column_def'], 'iw_');

    // Return the table information
    return $table;
}
Beispiel #24
0
/**
 * @authors Josep Ferràndiz Farré <*****@*****.**>
 * @authors Jordi Fons Vilardell  <*****@*****.**>
 * @authors Joan Guillén Pelegay  <*****@*****.**> 
 * 
 * @par Llicència: 
 * GNU/GPL - http://www.gnu.org/copyleft/gpl.html
 * @package Cataleg
 * @version 1.0
 * @copyright Departament d'Ensenyament. Generalitat de Catalunya 2012-2013
 */

function Cataleg_tables() {
    // Initialise table array
    $tables = array();
    
// CATALEG ************************************************************************************************* 
    // Cataleg: definició de la taula
    //          Contindrà la informació general del catàleg i l'estat 
    //          L'estat ens indica la visualització del catàleg. Cada estat incrementa la visualització
    //          0-Només el veuen els gestors
    //          1-El veuen els editors a 'les meves activitats'
    //		2-El veuen els editors en format 'catàleg' sense activitats
    //          3-El veuen els editors en format 'catàleg' complert
    //          4-El veuen els lectors
    //		Nota: els estats definits apareixen a la 1.0 (les versions anteriors tenien un altre sistema d'estats')
    $tables['cataleg'] = DBUtil::getLimitedTablename('cataleg');
    $tables['cataleg_column'] = array(
                'catId'   => 'catId',
                'anyAcad' => 'anyAcad', // Exemple: 2012-2013
                'nom'     => 'nom',	// Exemple: Catàleg unificat de formació del curs 2012-2013
                'estat'   => 'estat',   // Estat de visualització: 0, 1, 2, 3 o 4
                'editable'=> 'editable' // True si és el catàleg és editable (en les versions inicials(abans de la 1.0) hi havia el camp actiu)
            );

    $tables['cataleg_column_def'] = array(
                'catId'   => "I NOTNULL AUTO PRIMARY",
                'anyAcad' => "C(9) NOTNULL DEFAULT ''",
                'nom'     => "C(255) NOTNULL DEFAULT ''",
                'estat'   => "I1",
                'editable'=> "L NOTNULL DEFAULT 0"
            );
    // Afegir camps estàndard
    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_column_def'],'');
    
// EIXOS *************************************************************************************************   
    // eixos: definició de taula
    //                Contindrà informació relativa als eixos de les orientacions. 
    //                Cada prioritat s'enmarca en un eix
    $tables['cataleg_eixos'] = DBUtil::getLimitedTablename('cataleg_eixos');
    $tables['cataleg_eixos_column'] = array(
                'eixId'     => 'eixId',
                'catId'     => 'catId',
                'nom'       => 'nom',
                'nomCurt'   => 'nomCurt',
                'descripcio'=> 'descripcio',
                'ordre'     => 'ordre',
                'visible'   => 'visible'
            );

    $tables['cataleg_eixos_column_def'] = array(
                'eixId'     => "I NOTNULL AUTO PRIMARY",
                'catId'     => "I NOTNULL",
                'nom'       => "C(255)",
                'nomCurt'   => "C(100)" ,
                'descripcio'=> "X",
                'ordre'     => "C(2)",
                'visible'   => "L DEFAULT 1"
            );
    // Afegir camps estàndard
    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_eixos_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_eixos_column_def']);
    
// PRIORITATS *************************************************************************************************
    // prioritats:  definició de taula
    //              Recollirà la informació relativa a les prioritats i les orientacions
    $tables['cataleg_prioritats'] = DBUtil::getLimitedTablename('cataleg_prioritats');
    $tables['cataleg_prioritats_column'] = array(
                'priId'        => 'priId',
                'eixId'        => 'eixId',
                'nom'          => 'nom',
                'nomCurt'      => 'nomCurt',
                'orientacions' => 'orientacions',
                'recursos'     => 'recursos',
                'ordre'        => 'ordre',
                'visible'      => 'visible'
            );

    $tables['cataleg_prioritats_column_def'] = array(
                'priId'        => "I NOTNULL AUTO PRIMARY",
                'eixId'        => "I",
                'nom'          => "X",
                'nomCurt'      => "C(200)",
                'orientacions' => "X",
                'recursos'     => "X" ,
                'ordre'        => "I",
                'visible'      => "L DEFAULT 1"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_prioritats_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_prioritats_column_def']);

// UNITATS IMPLICADES *************************************************************************************************    
    // unitatsImplicades:  definició de taula
    //              Recollirà llista d'unitats implicades en una prioritat
    //              i les dades de les persones responsables
    $tables['cataleg_unitatsImplicades'] = DBUtil::getLimitedTablename('cataleg_unitatsImplicades');
    $tables['cataleg_unitatsImplicades_column'] = array(
                'impunitId'     => 'impunitId',       // Camp id de la taula d'unitats implicades   
                'priId'         => 'priId',          // Id prioritat relacionada
                'uniId'         => 'uniId',          // Id Unitat implicada
                'tematica'      => 'tematica',       // Opcional. Indicació temàtica específica de la prioritat
                'pContacte'     => 'pContacte',      // Persona de contacte
                'email'		=> 'email',	     // Correu electrònic de la persona de contacte
                'telContacte'   => 'telContacte',    // Telèfon/extensió persona de contacte
                'dispFormador'  => 'dispFormador'    // La unitat organitzadora disposa de persones formadores                
            );

    $tables['cataleg_unitatsImplicades_column_def'] = array(
                'impunitId'     => "I NOTNULL AUTO PRIMARY", //Afegit a la versió 1.0
                'priId'         => "I NOTNULL ",
                'uniId'         => "I NOTNULL ",
                'tematica'      => "C(50)",          // Opcional. Indicació temàtica específica de la prioritat
                'pContacte'     => "C(120)",         // Persona de contacte
                'email'		=> "C(50)",	     // Correu electrònic de la persona de contacte
                'telContacte'   => "C(20)",          // Telefon/extensió persona de contacte
                'dispFormador'  => "L NOTNULL DEFAULT 0"    // La unitat organitzadora disposa de persones formadores  
        
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_unitatsImplicades_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_unitatsImplicades_column_def']);    
    
// SUBPRIORITATS *************************************************************************************************
    // subprioritats:  definició de taula
    //                 Recollirà llista de subprioritats
    $tables['cataleg_subprioritats'] = DBUtil::getLimitedTablename('cataleg_subprioritats');
    $tables['cataleg_subprioritats_column'] = array(
                'sprId'   => 'sprId',
                'priId'   => 'priId',  // Id de la prioritat mare
                'nom'     => 'nom',
                'nomCurt' => 'nomCurt',
                'ordre'   => 'ordre',  //a, b, c, ...
                'visible' => 'visible'
            );

    $tables['cataleg_subprioritats_column_def'] = array(
                'sprId'   => "I NOTNULL AUTO PRIMARY",
                'priId'   => "I NOTNULL",
                'nom'     => "X",
                'nomCurt' => "C(200)",
                'ordre'   => "C(4)",
                'visible' => "L DEFAULT 1"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_subprioritats_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_subprioritats_column_def']);
    
// ACTIVITATS *************************************************************************************************    
    // activitats: definició de taula
    //             Recollirà informació relativa a les activitats proposades
    $tables['cataleg_activitats'] = DBUtil::getLimitedTablename('cataleg_activitats');
    $tables['cataleg_activitats_column'] = array(
                'actId'         => 'actId',                 
                'priId'         => 'priId',                 // Id de prioritat
                'sprId'         => 'sprId',                 // Id de subprioritat
                'uniId'         => 'uniId',                 // id del grup propietari de la fitxa (unitat)
                'titol'         => 'titol',                 // Títol activitat
                'prioritaria'   => 'prioritaria',           // Indica si l'activitat està prioritzada pel Dept.
                'tGTAF'         => 'tGTAF',                 // Tipologia GTAF
                'destinataris'  => 'destinataris',          // serialització dels id's a qui s'adreça(taula auxiliar/mode = "d")
                'observacions'  => 'observacions',          // perfil de les persones destinatàries
                'curs'          => 'curs',                  // curs, taller, seminari...
                'presencialitat'=> 'presencialitat',        // presencial, semipresencial, no presencial
                'abast'         => 'abast',                 // al centre, diversos centres
                'hores'         => 'hores',                 // Hores totals activitat
                'objectius'     => 'objectius',             // serialització d'objectius
                'continguts'    => 'continguts',            // serialització de continguts
                'gestio'        => 'gestio',                // serialització de les opcions de gestió: ID taula auxiliar tipus "gest"
                'estat'         => 'estat',                 // 
                'ordre'         => 'ordre',                 // Per si es vol forçar alguna ordenació no alfabètica 
                'validador'     => 'validador',             // uid de la persona que valida la fitxa
                'dataVal'       => 'dataVal',               // Data de validació              
                'dataModif'     => 'dataModif',             // Data de modificació per publicitar
                'obs_validador' => 'obs_validador',         // Notes del validador a l'editor
                'obs_editor'    => 'obs_editor',            // Notes de l'editor al validador
                'centres'       => 'centres',               // Relació de centres (serialitzat)
                'info'          => 'info',                  // Observacions generals - visibles a la fitxa
                'activa'        => 'activa'
            );

    $tables['cataleg_activitats_column_def'] = array(
                'actId'         => "I NOTNULL AUTO PRIMARY", 
                'priId'         => "I",            
                'sprId'         => "I",             
                'uniId'         => "I",          // id del grup propietari de la fitxa (unitat)
                'titol'         => "C(255)", 
                'prioritaria'   => "L DEFAULT 0",
                'tGTAF'         => "C(4)",       // Tipologia GTAF
                'destinataris'  => "C(255)",     // serialització dels id's a qui s'adreça(taula destinataris)
                                                 //(taula destinataris) ID taula auxiliar tipus "dest"	
                'observacions'  => "C(255)",     // perfil de les persones destinatàries
                'curs'          => "I",          // ID taula auxiliar tipus:"curs" curs, taller, seminari...
                'presencialitat'=> "I",          // ID taula auxiliar tipus:"pres" presencial, semi, no presencial
                'abast'         => "I",          // ID taula auxiliar tipus:"abast" al centre, diversos centres
                'hores'		=> "I2 UNSIGNED",// Durada en hores de l'activitat
                'objectius'     => "X",          // serialització d'objectius
                'continguts'    => "X",          // serialització de continguts
                'gestio'        => "X",     // serialització de les opcions de gestió: ID taula auxiliar tipus "gest"
                                                 // tipus "gest" + gesId taula gestioActivitatDefaults
                'estat'         => "I1 DEFAULT 0",  // Estat de la fitxa codificat: 
						    // 0 -> esborrany;
						    // 1 -> enviada
						    // 2 -> cal revisar
						    // 3 -> validada
						    // 4 -> modificada
                                                    // 5 -> anul·lada
     		'ordre'   	=> "I2 UNSIGNED",// Per si es vol forçar alguna ordenació no alfabètica
                'validador'     => "I",          // uid de la persona que valida la fitxa
                'dataVal'       => "T",          // Datetime o timestamp de validació
                'dataModif'     => "T",          // Datetime de la validació de modificació per publicitar
		'obs_validador' => "X",          // Text per observacions de pers. validadora a editora
		'obs_editor'    => "X",          // Text per observacions de pers. editora a validadora 
                'centres'       => "X",
                'info'          => "X",          // Text per a observacions generals - camp ordinari de la fitxa
		'activa'        => "L DEFAULT 1"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_activitats_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_activitats_column_def']);

// ACTIVITATS ZONA *************************************************************************************************    
    // activitatsZona: definició de taula
    //            per a cada activitat recollir distribució territorial
    //            Relació amb la taula activitats pel camp actId 
    $tables['cataleg_activitatsZona'] = DBUtil::getLimitedTablename('cataleg_activitatsZona');
    $tables['cataleg_activitatsZona_column'] = array(
                'actId'   => 'actId',      // Id activitat relacionada
                'lloc'    => 'lloc',       // lloc o Id del lloc de realització
                'qtty'    => 'qtty',       // Quantitat d'activitats previstes
                'mesInici'=> 'mesInici'    // Mes d'inici de l'activitat                
            );

    $tables['cataleg_activitatsZona_column_def'] = array(
                'actId'   => "I NOTNULL PRIMARY",
                'lloc'    => "I PRIMARY",         // Id del lloc de realització (taula auxiliar: tipus "c"
                'qtty'    => "C(3)",                // Quantitat d'activitats previstes                
                'mesInici'=> "C(10)"              // Mes d'inici de l'activitat
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_activitatsZona_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_activitatsZona_column_def']);    
    
// UNITATS *************************************************************************************************    
    // unitats:  definició de taula
    //           Recollirà llista de subprioritats
    $tables['cataleg_unitats'] = DBUtil::getLimitedTablename('cataleg_unitats');
    $tables['cataleg_unitats_column'] = array(
                'uniId'      => 'uniId',
                'gzId'       => 'gzId',        // Identificador del grup Zikula ambpermís per gestionar aquesta unitat
                'catId'      => 'catId',
                'nom'        => 'nom',
                'descripcio' => 'descripcio',
                'activa'     => 'activa'
            );

    $tables['cataleg_unitats_column_def'] = array(
                'uniId'      => "I NOTNULL AUTO PRIMARY",
                'gzId'       => "I",
                'catId'      => "I",                        
                'nom'        => "C(255)",
                'descripcio' => "X",                
                'activa'     => "L DEFAULT 1"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_unitats_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_unitats_column_def']);
    

// RESPONSABLES *************************************************************************************************    
    // responsables: definició de taula
    //               recull informació de les persones responsable d'una unitat o servei
    // UNITATS <---- RESPONSABLES (camp relacionats: uniId, uniId)
    $tables['cataleg_responsables'] = DBUtil::getLimitedTablename('cataleg_responsables');
    $tables['cataleg_responsables_column'] = array(
                'respunitId'  => 'respunitId',   //Id de la taula  
                'uniId'       => 'uniId',       // Id de la unitat de la persona responsable
                'responsable' => 'responsable', // Nom i cognoms de la persona responsable
                'email'       => 'email',       // Correu electrònic de la pers. responsable
                'telefon'     => 'telefon'      // Telefon i extensió
            );

    $tables['cataleg_responsables_column_def'] = array(
                'respunitId'  => "I NOTNULL AUTO PRIMARY", //Afegit ala versió 1.0
                'uniId'       => "I NOTNULL",
                'responsable' => "C(120)",      // Nom i cognoms de la persona responsable
                'email'       => "C(50)",       // Correu electrònic de la pers. responsable
                'telefon'     => "C(20)"        // Telefon i extensió        
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_responsables_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_responsables_column_def']);    
    
// CONTACTES *************************************************************************************************    
    // contactes: definició de taula
    //               recull informació de les persones de contacte relacionades amb una activitat
    //               Fitxa: activitats
    //               
    // ACTIVITATS <---- CONTACTES (camp relacionats: actId, actId)
    $tables['cataleg_contactes'] = DBUtil::getLimitedTablename('cataleg_contactes');
    $tables['cataleg_contactes_column'] = array(
                'actId'       => 'actId',       // Id de la unitat de la persona responsable
                'pContacte'   => 'pContacte', // Nom i cognoms de la persona responsable
                'email'       => 'email',       // Correu electrònic de la pers. responsable
                'telefon'     => 'telefon'      // Telefon i extensió
            );

    $tables['cataleg_contactes_column_def'] = array(
                'actId'       => "I",
                'pContacte'   => "C(120)",      // Nom i cognoms de la persona responsable
                'email'       => "C(50)",       // Correu electrònic de la pers. responsable
                'telefon'     => "C(20)"        // Telefon i extensió        
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_contactes_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_contactes_column_def']);    
    
// AUXILIAR *************************************************************************************************    
    // auxiliar: definició de taula
    //           Contindrà informació ítul en llistats o desplegables agrupats per "tipus"
    //           tipus "dest": possibles distinatris de la formació (Infantil, Primària, CdA, ...)
    //		 tipus "abast": abast de la formació (al centre / diversos centres)
    //		 tipus "pres": modalitat de la formació (semi/presencial/no presencial)
    //		 tipus "curs": tipologia de la formació (curs, taller, seminari, jornada, ...)
    //           tipus "sstt": llistat de comarques (SSTT)
    //           tipus "gest": (gestió) Servei educatiu, Servei territorial, Unitat, PEEE, ...
    $tables['cataleg_auxiliar'] = DBUtil::getLimitedTablename('cataleg_auxiliar');
    $tables['cataleg_auxiliar_column'] = array(
                'auxId'   => 'auxId',
                'nom'     => 'nom',       
                'nomCurt' => 'nomCurt',
                'tipus'   => 'tipus',       // tipus "dest": possibles distinatris de la formació (Infantil, Primària, CdA, ...)
                                            // tipus "abast": abast de la formació (al centre / diversos centres)
                                            // tipus "pres": modalitat de la formació (semi/presencial/no presencial)
                                            // tipus "curs": tipologia de la formació (curs, taller, seminari, jornada, ...)
                                            // tipus "sstt": llistat de comarques (SSTT)
                                            // tipus "gest": (gestió) Servei educatiu, Servei territorial, Unitat, PEEE, ...
                'ordre'   => 'ordre',
                'visible' => 'visible'
                
            );

    $tables['cataleg_auxiliar_column_def'] = array(
                'auxId'   => "I NOTNULL AUTO PRIMARY",
                'nom'     => "C(50) NOTNULL",
                'nomCurt' => "C(10)",
                'tipus'   => "C(5)",
		'ordre'   => "I1 UNSIGNED DEFAULT 125",
                'visible' => "L DEFAULT 1"
        
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_auxiliar_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_auxiliar_column_def']);   

// GESTIÓ *************************************************************************************************    
    // gestio: definició de taula
    //         opcions per defecte i elements de gestió d'una activitat
    $tables['cataleg_gestioActivitatDefaults'] = DBUtil::getLimitedTablename('cataleg_gestioActivitatDefaults');
    $tables['cataleg_gestioActivitatDefaults_column'] = array(
                'gesId'    => 'gesId',
                'text'     => 'text',       //Cerca el lloc..., Difusió, Donar d'alta al GTAF, ...
                'opcions'  => 'opcions',    //Serialització dels elements a mostrar en la llista desplegable: 
                                            //ID taula auxiliar: tipus "gest" -> SE, ST, ...
                'opSE'     => 'opSE',       // Default per a servei educatiu Id
                'opST'     => 'opST',       // Default per a servei territorial Id
                'opUN'     => 'opUN',       // Default per a Unitat Id
                'ordre'    => 'ordre',      // Ordre per mostrar els diferents elements de gestió
                'visible'  => 'visible'                
            );

    $tables['cataleg_gestioActivitatDefaults_column_def'] = array(
                'gesId'    => "I NOTNULL AUTO PRIMARY",
                'text'     => "C(50)",      //Cerca el lloc..., Difusió, Donar d'alta al GTAF, ...
                'opcions'  => "C(255)",     //Serialització dels elements a mostrar en la llista desplegable: 
                                            //ID taula auxiliar: tipus "gest" -> SE, ST, ...
                'opSE'     => "I",          // Default per a servei educatiu Id
                'opST'     => "I",          // Default per a servei territorial Id
                'opUN'     => "I",          // Default per a Unitat Id
                'ordre'    => "I1 UNSIGNED",// (0 -  255) Ordre per mostrar els diferents elements de gestió
                'visible'  => "L DEFAULT 1"
        
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_gestioActivitat_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_gestioActivitat_column_def']);    
    
// CENTRESACTIVITAT *************************************************************************************************    
    // centresActivitat: definició de taula
    //         opcions per defecte i elements de gestió d'una activitat
    $tables['cataleg_centresActivitat'] = DBUtil::getLimitedTablename('cataleg_centresActivitat');
    $tables['cataleg_centresActivitat_column'] = array(
                'actId'    => 'actId',
                'centre'   => 'centre'        
            );

    $tables['cataleg_centresActivitat_column_def'] = array(
                'actId'    => "I NOTNULL PRIMARY",
                'centre'   => "C(8) NOTNULL PRIMARY"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_centresActivitat_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_centresActivitat_column_def']);    

// CENTRES *************************************************************************************************    
    // centres: definició de taula
    // importació de la informació del GTAF per tenir la informació dels centres de Catalunya
    $tables['cataleg_centres'] = DBUtil::getLimitedTablename('cataleg_centres');
    $tables['cataleg_centres_column'] = array(
        'CODI_ENTITAT'      => 'CODI_ENTITAT',
        'CODI_TIPUS_ENTITAT'=> 'CODI_TIPUS_ENTITAT',
	'NOM_ENTITAT'       => 'NOM_ENTITAT',
	'NOM_LOCALITAT'     => 'NOM_LOCALITAT',
	'NOM_DT'            => 'NOM_DT',
	'CODI_DT'           => 'CODI_DT',
	'NOM_TIPUS_ENTITAT' => 'NOM_TIPUS_ENTITAT'
     );

    $tables['cataleg_centres_column_def'] = array(
        'CODI_ENTITAT'      => "C(8) NOTNULL PRIMARY",
        'CODI_TIPUS_ENTITAT'=> "C(5)",
	'NOM_ENTITAT'       => "C(50)",
	'NOM_LOCALITAT'     => "C(50)",
	'NOM_DT'            => "C(50)",
	'CODI_DT'           => "C(1)",
	'NOM_TIPUS_ENTITAT' => "C(30)"
    );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_centres_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_centres_column_def']);    

// importTaules *************************************************************************************************    
    // Recull les correspondències definides entre catàlegs per a poder importar activitats
    // 
    $tables['cataleg_importTaules'] = DBUtil::getLimitedTablename('cataleg_importTaules');
    $tables['cataleg_importTaules_column'] = array(
        'importId'  => 'importId',
        'catIdOri'  => 'catIdOri',
	'catIdDest' => 'catIdDest'
	            );

    $tables['cataleg_importTaules_column_def'] = array(
        'importId'  => "I NOTNULL AUTO PRIMARY", //index, es fa servir com a referència a cataleg_importAssign
        'catIdOri'  => "I", //catId del Catàleg origen de la importació
	'catIdDest' => "I" //catId del Catàleg destinació de la importació
		            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_importTaules_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_importTaules_column_def']);
    $tables['cataleg_importTaules_column_idx'] = array ('catsId' => array('columns' => array('catIdOri', 'catIdDest'),'options' => array('UNIQUE' => true)));
// Taula cataleg_importAssign *************************************************************************************************    
    // Recull les relacions entre prioritat-subprioritat d'un catàleg i un altre
    // Permet fer l'assignació de valors en importar activitats entre dos catàlegs
    $tables['cataleg_importAssign'] = DBUtil::getLimitedTablename('cataleg_importAssign');
    $tables['cataleg_importAssign_column'] = array(
        'importId' => 'importId',
        'idsOri'   => 'idsOri',
	'idsDest'  => 'idsDest'
     );

    $tables['cataleg_importAssign_column_def'] = array(
        'importId' => "I NOTNULL", // index de la taula cataleg_importTaules on s'estableix la correspondència
        'idsOri'   => "C(25) NOTNULL PRIMARY", //priId$$sprId del catàleg origen
	'idsDest'  => "C(25) NOTNULL PRIMARY" //priId$$sprId del catàleg destinació
    );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['cataleg_importAssign_column'], 'pn_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['cataleg_importAssign_column_def']);    

// Taula cataleg_gtafEntities *************************************************************************************************
    // Recull les entitats de gtaf utilitzaces per a l'assignació dels usuaris
    // Corresponen a unitats (ex-> 0552), st (ex-> 7) i crp (ex-> 702)
    // El camp tipus podrà ser UNI, ST o SE
    $tables['cataleg_gtafEntities'] = DBUtil::getLimitedTablename('cataleg_gtafEntities');
    $tables['cataleg_gtafEntities_column'] = array(
        'gtafEntityId'  => 'gtafEntityId',
        'nom'           => 'nom',
        'tipus'         => 'tipus',
        'gtafGroupId'   => 'gtafGroupId'
    );
    $tables['cataleg_gtafEntities_column_def'] = array(
        'gtafEntityId'  => 'C(5) NOTNULL PRIMARY',
        'nom'           => 'C(100) NOTNULL',
        'tipus'         => 'C(5) NOTNULL',
        'gtafGroupId'   => 'C(5) NOTNULL'
    );
// Taula cataleg_gtafGroups ***************************************************************************************************
    // Recull les agrupacions d'enitats de gtaf amb la seva dependència orgànica
    // Utilitzarem els mateixos codis que té la seva entitat (gtafEnitityId) principal
    $tables['cataleg_gtafGroups'] = DBUtil::getLimitedTablename('cataleg_gtafGroups');
    $tables['cataleg_gtafGroups_column'] = array(
        'gtafGroupId'   => 'gtafGroupId',
        'nom'           => 'nom',
        'resp_uid'      => 'resp_uid'
    );
    $tables['cataleg_gtafGroups_column_def'] = array(
        'gtafGroupId'   => 'C(5) NOTNULL PRIMARY',
        'nom'           => 'C(100) NOTNULL',
        'resp_uid'      => 'I'
    );

    // Inclusió de la definició de la taula IWusers 
    $tables['IWusers'] = DBUtil::getLimitedTablename('IWusers');
    $tables['IWusers_column'] = array(
        'suid'        => 'iw_suid',
        'uid'         => 'iw_uid',
        'id'          => 'iw_id',
        'nom'         => 'iw_nom',
        'cognom1'     => 'iw_cognom1',
        'cognom2'     => 'iw_cognom2',
        'naixement'   => 'iw_naixement',
        'accio'       => 'iw_accio',
        'sex'         => 'iw_sex',
        'description' => 'iw_description',
        'avatar'      => 'iw_avatar',
        'newavatar'   => 'iw_newavatar',
        'code'        => 'iw_code'
    );
    $tables['IWusers_column_def'] = array('suid' => "I NOTNULL AUTO PRIMARY",
        'uid' => "I NOTNULL DEFAULT '0'",
        'id' => "C(50) NOTNULL DEFAULT ''",
        'nom' => "C(25) NOTNULL DEFAULT ''",
        'cognom1' => "C(25) NOTNULL DEFAULT ''",
        'cognom2' => "C(25) NOTNULL DEFAULT ''",
        'naixement' => "C(8) NOTNULL DEFAULT ''",
        'accio' => "I(1) NOTNULL DEFAULT '0'",
        'sex' => "C(1) NOTNULL DEFAULT ''",
        'description' => "X NOTNULL",
        'avatar' => "C(50) NOTNULL DEFAULT ''",
        'newavatar' => "C(50) NOTNULL DEFAULT ''",
        'code'      => "C(5)"
    );

    //Returns informació de les taules
    return $tables;
}
Beispiel #25
0
 /**
  * Delete the contents of a user variable.
  *
  * This can either be
  * - a variable stored in the users table or
  * - an attribute to the users table, either a new style sttribute or the old style user information
  *
  * Examples:
  * UserUtil::delVar('ublock');  // clears the recent users table entry for 'ublock'
  * UserUtil::delVar('_YOURAVATAR', 123), // removes a users avatar, old style (uid = 123)
  * UserUtil::delVar('avatar', 123);  // removes a users avatar, new style (uid=123)
  * (internally both the new style and the old style clear the same attribute)
  *
  * It does not allow the deletion of uid, email, uname, pass (password), as these are mandatory
  * fields in the users table.
  *
  * @param string  $name The name of the variable.
  * @param integer $uid  The user to delete the variable for.
  *
  * @return boolen true on success, false on failure
  */
 public static function delVar($name, $uid = -1)
 {
     // Prevent deletion of core fields (duh)
     if (empty($name) || $name == 'uid' || $name == 'email' || $name == 'pass' || $name == 'uname' || $name == 'activated') {
         return false;
     }
     if ($uid == -1) {
         $uid = SessionUtil::getVar('uid');
     }
     if (empty($uid)) {
         return false;
     }
     // Special delete value for approved_by
     if ($name == 'approved_by') {
         return (bool) self::setVar($name, -1, $uid);
     }
     $isRegistration = self::isRegistration($uid);
     $origUserObj = self::getVars($uid, false, 'uid', $isRegistration);
     if (!$origUserObj) {
         // No such user record!
         return false;
     }
     $varIsDeleted = false;
     // Cannot delVar the user's uid or uname
     if ($name != 'uid' && $name != 'uname') {
         if (self::fieldAlias($name)) {
             // this value comes from the users table
             $obj = array('uid' => $uid, $name => '');
             $oldValue = isset($origUserObj[$name]) ? $origUserObj[$name] : null;
             $varIsDeleted = (bool) DBUtil::updateObject($obj, 'users', '', 'uid');
         } else {
             // Not a table field alias, not 'uid', and not 'uname'. Treat it as an attribute.
             $dudAttributeName = self::convertOldDynamicUserDataAlias($name);
             if ($dudAttributeName) {
                 LogUtil::log(__f('Warning! User variable [%1$s] is deprecated. Please use [%2$s] instead.', array($name, $mappingarray[$name])), E_USER_DEPRECATED);
                 // $name is a former DUD /old style user information now stored as an attribute
                 $attributeName = $dudAttributeName;
             } else {
                 // $name not in the users table and also not found in the mapping array and also not one of the
                 // forbidden names, let's make an attribute out of it
                 $attributeName = $name;
             }
             $oldValue = isset($origUserObj['__ATTRIBUTES__'][$attributeName]) ? $origUserObj['__ATTRIBUTES__'][$attributeName] : null;
             $varIsDeleted = (bool) ObjectUtil::deleteObjectSingleAttribute($uid, 'users', $attributeName);
         }
         // force loading of attributes from db
         $updatedUserObj = self::getVars($uid, true, '', $isRegistration);
         if (!$updatedUserObj) {
             // Should never get here!
             return false;
         }
         // Do not fire update event/hook unless the update happened, it was not a registration record, it was not
         // the password being updated, and the system is not currently being installed.
         if ($varIsDeleted && $name != 'pass' && !System::isInstalling()) {
             // Fire the event
             $eventArgs = array('action' => 'delVar', 'field' => isset($attributeName) ? null : $name, 'attribute' => isset($attributeName) ? $attributeName : null);
             $eventData = array('old_value' => $oldValue);
             if ($isRegistration) {
                 $updateEvent = new Zikula_Event('user.registration.update', $updatedUserObj, $eventArgs, $eventData);
             } else {
                 $updateEvent = new Zikula_Event('user.account.update', $updatedUserObj, $eventArgs, $eventData);
             }
             EventUtil::notify($updateEvent);
         }
     }
     return $varIsDeleted;
 }
Beispiel #26
0
    /**
     * move field
     */
    public function moveField()
    {
        if (!SecurityUtil::checkPermission('Categories::', '::', ACCESS_EDIT)) {
            return LogUtil::registerPermissionError();
        }

        $cid = (int)FormUtil::getPassedValue('cid', 0, 'GET');
        $dir = FormUtil::getPassedValue('direction', null, 'GET');
        $dr = (int)FormUtil::getPassedValue('dr', 0, 'GET');
        $url = System::serverGetVar('HTTP_REFERER');

        if (!$dr) {
            return LogUtil::registerError($this->__('Error! The document root is invalid.'), null, $url);
        }

        if (!$cid) {
            return LogUtil::registerError($this->__('Error! The category ID is invalid.'), null, $url);
        }

        if (!$dir) {
            return LogUtil::registerError($this->__f('Error! Invalid [%s] received.', 'direction'), null, $url);
        }

        $cats = CategoryUtil::getSubCategories($dr, false, false, false, false);
        $cats = CategoryUtil::resequence($cats, 10);
        $ak = array_keys($cats);
        foreach ($ak as $k) {
            $obj = new Categories_DBObject_Category($cats[$k]);
            $obj->update();
        }

        $data = array('id' => $cid);
        $val = ObjectUtil::moveField($data, 'categories_category', $dir, 'sort_value');

        $url = System::serverGetVar('HTTP_REFERER');
        $this->redirect($url);
    }
Beispiel #27
0
 /**
  * Delete a database table.
  *
  * @param string $table Table a tablename key for the tables structure.
  *
  * @return boolean
  * @throws Exception If the $table parameter is empty or does not point to valid table definition.
  */
 public static function dropTable($table)
 {
     if (empty($table)) {
         throw new Exception(__f('The parameter %s must not be empty', 'table'));
     }
     $tables = self::getTables();
     $tableName = $tables[$table];
     if (empty($tableName)) {
         throw new Exception(__f('%s does not point to a valid table definition', $table));
     }
     try {
         Doctrine_Manager::getInstance()->getCurrentConnection()->export->dropTable($tableName);
         ObjectUtil::deleteAllObjectTypeAttributes($table);
     } catch (Exception $e) {
         return LogUtil::registerError(__('Error! Table drop failed.') . ' ' . $e->getMessage());
     }
     self::flushCache($table);
     return true;
 }
Beispiel #28
0
 /**
  * Get all Quotes
  * @author The Zikula Development Team
  * @author Greg Allan
  * @return array array containing quote id, quote, author
  */
 public function getall($args)
 {
     // security check
     if (!SecurityUtil::checkPermission('Quotes::', '::', ACCESS_READ)) {
         return array();
     }
     $where = $this->_process_args($args);
     $sort = isset($args['sort']) && $args['sort'] ? $args['sort'] : '';
     $sortdir = isset($args['sortdir']) && $args['sortdir'] ? $args['sortdir'] : 'ASC';
     if ($sort) {
         if ($sort == 'qid') {
             $sort .= ' ' . $sortdir;
         } else {
             $sort .= ' ' . $sortdir . ', qid ' . $sortdir;
         }
     } else {
         $sort = 'qid DESC';
     }
     // define the permissions filter to use
     $permFilter = array();
     $permFilter[] = array('realm' => 0, 'component_left' => 'Quotes', 'component_middle' => '', 'component_right' => '', 'instance_left' => 'author', 'instance_middle' => '', 'instance_right' => 'qid', 'level' => ACCESS_READ);
     $args['catFilter'] = array();
     if (isset($args['category']) && !empty($args['category'])) {
         if (is_array($args['category'])) {
             $args['catFilter'] = $args['category'];
         } elseif (isset($args['property'])) {
             $property = $args['property'];
             $args['catFilter'][$property] = $args['category'];
         }
         $args['catFilter']['__META__'] = array('module' => 'Quotes');
     }
     // get the object array from the db
     $objArray = DBUtil::selectObjectArray('quotes', $where, $sort, $args['startnum'], $args['numitems'], '', $permFilter, $args['catFilter']);
     // check for an error with the database code, and if so set an appropriate
     // error message and return
     if ($objArray === false) {
         return LogUtil::registerError($this->__('Error! Could not load any quotes.'));
     }
     // need to do this here as the category expansion code can't know the
     // root category which we need to build the relative path component
     if ($objArray && isset($args['catregistry']) && $args['catregistry']) {
         ObjectUtil::postProcessExpandedObjectArrayCategories($objArray, $args['catregistry']);
     }
     // return the items
     return $objArray;
 }
Beispiel #29
0
    /**
     * get all pages
     *
     * @param array $args Arguments array.
     *
     * @return mixed array of items, or false on failure
     */
    public function getall($args)
    {
        // Optional arguments.
        if (!isset($args['startnum']) || empty($args['startnum'])) {
            $args['startnum'] = 0;
        }
        if (!isset($args['numitems']) || empty($args['numitems'])) {
            $args['numitems'] = -1;
        }
        if (!isset($args['ignoreml']) || !is_bool($args['ignoreml'])) {
            $args['ignoreml'] = false;
        }
        if (!isset($args['language'])) {
            $args['language'] = null;
        }
        if (!isset($args['category'])) {
            $args['category'] = null;
        }

        if (!is_numeric($args['startnum']) || !is_numeric($args['numitems'])) {
            return LogUtil::registerArgsError();
        }

        // Security check
        if (!SecurityUtil::checkPermission('Pages::', '::', ACCESS_READ)) {
            return array();
        }

        $catFilter = array();
        if (isset($args['category']) && !empty($args['category'])) {
            if (is_array($args['category'])) {
                $catFilter = $args['category'];
            } elseif (isset($args['property'])) {
                $property = $args['property'];
                $catFilter[$property] = $args['category'];
            }
            $catFilter['__META__'] = array('module' => 'Pages');
        } elseif (isset($args['catfilter'])) {
            $catFilter = $args['catfilter'];
        }

        // populate an array with each part of the where clause and then implode the array if there is a need.
        // credit to Jorg Napp for this technique - markwest
        $table = DBUtil::getTables();
        $pagescolumn = $table['pages_column'];
        $queryargs = array();
        if (System::getVar('multilingual') == 1 && !$args['ignoreml'] && $args['language']) {
            $queryargs[] = '(' . $pagescolumn['language'] . ' = "' . DataUtil::formatForStore($args['language']) . '"'
                    .' OR ' . $pagescolumn['language'] . ' = "")';
        }

        $where = null;
        if (count($queryargs) > 0) {
            $where = ' WHERE ' . implode(' AND ', $queryargs);
        }

        // define the permission filter to apply
        $permFilter   = array();
        $permFilter[] = array('component_left'  => 'Pages',
                'instance_left'   => 'title',
                'instance_right'  => 'pageid',
                'level'           => ACCESS_READ);

        $orderby = $pagescolumn['pageid'];
        if (isset($args['order']) && !empty($args['order'])) {
            $orderby = $pagescolumn[strtolower($args['order'])];
        }
        $orderdir = 'DESC';
        if (isset($args['orderdir']) && !empty($args['orderdir'])) {
            $orderdir = $args['orderdir'];
        }
        $orderby = $orderby . ' ' . $orderdir;

        // get the objects from the db
        $objArray = DBUtil::selectObjectArray(
            'pages',
            $where,
            $orderby,
            $args['startnum']-1,
            $args['numitems'],
            '',
            $permFilter,
            $catFilter
        );

        // check for an error with the database code, and if so set an appropriate
        // error message and return
        if ($objArray === false) {
            return LogUtil::registerError($this->__('Error! Could not load any page.'));
        }

        // need to do this here as the category expansion code can't know the
        // root category which we need to build the relative path component
        if ($objArray && isset($args['catregistry']) && $args['catregistry']) {
            ObjectUtil::postProcessExpandedObjectArrayCategories($objArray, $args['catregistry']);
        }

        // return the items
        return $objArray;
    }
Beispiel #30
0
/**
 * @authors Josep Ferràndiz Farré <*****@*****.**>
 * @authors Jordi Fons Vilardell  <*****@*****.**>
 * @authors Joan Guillén Pelegay  <*****@*****.**>
 *
 * @par Llicència:
 * GNU/GPL - http://www.gnu.org/copyleft/gpl.html
 * @package Llicencies
 * @version 1.0
 * @copyright Departament d'Ensenyament. Generalitat de Catalunya 2013-2014
 */

function Llicencies_tables() {
    // Initialise table array
    $tables = array();

// LLICENCIES *************************************************************************************************
    // llicencies: 
    //          Contindrà la informació de les llicències d'estudi realitzades i l'estat de finalització
    
    $tables['llicencies'] = DBUtil::getLimitedTablename('llicencies');
    $tables['llicencies_column'] = array(
                'codi_treball'     => 'codi_treball',
                'titol'            => 'titol',
                'caracteristiques' => 'caracteristiques',
                'orientacio'       => 'orientacio',
                'nivell'           => 'nivell' ,
                'resum'            => 'resum' ,
                'annexos'          => 'annexos' ,
                'web'              => 'web' ,
                'altres'           => 'altres' ,
                'tema'             => 'tema' ,
                'subtema'          => 'subtema' ,
                'tipus'            => 'tipus',
                'curs'             => 'curs',
                'capsa'            => 'capsa',
                'url'              => 'url',
                'modalitat'        => 'modalitat',
                'cognoms'          => 'cognoms',
                'nom'              => 'nom',
                'correuel'         => 'correuel',
                'estat'            => 'estat'                                
            );

    $tables['llicencies_column_def'] = array(
                'codi_treball'     => "I NOTNULL AUTO PRIMARY",
                'titol'            => "C(255) NOTNULL",
                'caracteristiques' => "X",
                'orientacio'       => "X",
                'nivell'           => "C(255)",
                'resum'            => "X",
                'annexos'          => "C(255)" ,
                'web'              => "C(255)" ,
                'altres'           => "C(255)" ,
                'tema'             => "I" ,
                'subtema'          => "I" ,
                'tipus'            => "I" ,
                'curs'             => "C(10)",
                'capsa'            => "C(10)",
                'url'              => "C(255)" ,
                'modalitat'        => "C(3)" ,
                'cognoms'          => "C(255)" ,
                'nom'              => "C(100)" ,
                'correuel'         => "C(255)",
                'estat'            => "I"            
            );
    // Afegir camps estàndard
    ObjectUtil::addStandardFieldsToTableDefinition($tables['llicencies_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['llicencies_column_def']);

// CURS *************************************************************************************************
    // curs: llistat de cursos disponibles format yyyy/yy
    $tables['llicencies_curs'] = DBUtil::getLimitedTablename('llicencies_curs');
    $tables['llicencies_curs_column'] = array(
                'curs'     => 'curs'
            );

    $tables['llicencies_curs_column_def'] = array(
                'curs'     => "C(10) NOTNULL PRIMARY"
            );
    // Afegir camps estàndard
    ObjectUtil::addStandardFieldsToTableDefinition($tables['llicencies_curs_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['llicencies_curs_column_def']);

// MODALITAT *************************************************************************************************
// modalitat de llicència A, B1, B2, B3 o C
    $tables['llicencies_modalitat'] = DBUtil::getLimitedTablename('llicencies_modalitat');
    $tables['llicencies_modalitat_column'] = array(
                'id_mod'     => 'id_mod',
                'descripcio' => 'descripcio'
            );

    $tables['llicencies_modalitat_column_def'] = array(
                'id_mod'     => "C(3) NOTNULL PRIMARY",
                'descripcio' => "C(255) NOTNULL"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['llicencies_modalitat_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['llicencies_modalitat_column_def']);


// TEMA *************************************************************************************************
    $tables['llicencies_tema'] = DBUtil::getLimitedTablename('llicencies_tema');
    $tables['llicencies_tema_column'] = array(
                'codi_tema' => 'codi_tema',
                'nom'       => 'nom'
            );

    $tables['llicencies_tema_column_def'] = array(
                'codi_tema' => "I NOTNULL PRIMARY",
                'nom'       => "C(255) NOTNULL"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['llicencies_tema_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['llicencies_tema_column_def']);

// SUBTEMA *************************************************************************************************
    $tables['llicencies_subtema'] = DBUtil::getLimitedTablename('llicencies_subtema');
    $tables['llicencies_subtema_column'] = array(
                'codi_subt' => 'codi_subt',
                'nom'          => 'nom'
            );

    $tables['llicencies_subtema_column_def'] = array(
                'codi_subt' => "I NOTNULL PRIMARY",
                'nom'          => "C(255) NOTNULL"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['llicencies_subtema_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['llicencies_subtema_column_def']);
    
// TIPUS *************************************************************************************************
//     Més categories relatives a l'àmbit del treball
    $tables['llicencies_tipus'] = DBUtil::getLimitedTablename('llicencies_tipus');
    $tables['llicencies_tipus_column'] = array(
                'codi_tipus'   => 'codi_tipus',
                'nom'          => 'nom'
            );

    $tables['llicencies_tipus_column_def'] = array(
                'codi_tipus'   => "I NOTNULL PRIMARY",
                'nom'          => "C(255) NOTNULL"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['llicencies_tipus_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['llicencies_tipus_column_def']);

// ESTATS *************************************************************************************************
// estat de la llicència: 
// sense memòria pdf, preparada, pròrroga, renúncia, expedient, desapareguda, pendent, en elaboració
    
    $tables['llicencies_estats'] = DBUtil::getLimitedTablename('llicencies_estats');
    $tables['llicencies_estats_column'] = array(
                'id_estat'   => 'id_estat',
                'descripcio' => 'descripcio'
            );

    $tables['llicencies_estats_column_def'] = array(
                'id_estat'   => "I NOTNULL PRIMARY",
                'descripcio' => "C(255) NOTNULL"
            );

    ObjectUtil::addStandardFieldsToTableDefinition($tables['llicencies_estats_column']);
    ObjectUtil::addStandardFieldsToTableDataDefinition($tables['llicencies_estats_column_def']);

    //Returns informació de les taules
    return $tables;
}