/** * Constructor * * @param object table Database row * @param string * @param string * @param string * @param string for derived classes * @param string datetime field name * @param string datetime field name * @param string User ID field name * @param string User ID field name */ function Item($db_row = NULL, $dbtable = 'T_items__item', $dbprefix = 'post_', $dbIDname = 'post_ID', $objtype = 'Item', $datecreated_field = 'datecreated', $datemodified_field = 'datemodified', $creator_field = 'creator_user_ID', $lasteditor_field = 'lastedit_user_ID') { global $localtimenow, $default_locale, $current_User; // Call parent constructor: parent::ItemLight($db_row, $dbtable, $dbprefix, $dbIDname, $objtype, $datecreated_field, $datemodified_field, $creator_field, $lasteditor_field); if (is_null($db_row)) { // New item: global $Blog; if (isset($current_User)) { // use current user as default, if available (which won't be the case during install) $this->creator_user_login = $current_User->login; $this->set_creator_User($current_User); } $this->set('dateset', 0); // Date not explicitly set yet $this->set('notifications_status', 'noreq'); // Set the renderer list to 'default' will trigger all 'opt-out' renderers: $this->set('renderers', array('default')); // we prolluy don't need this: $this->set( 'status', 'published' ); $this->set('locale', $default_locale); $this->set('priority', 3); if (!empty($Blog)) { // Get default post type from blog setting $default_post_type = $Blog->get_setting('default_post_type'); } $this->set('ityp_ID', empty($default_post_type) ? 1 : $default_post_type); } else { $this->datecreated = $db_row->post_datecreated; // When Item was created in the system $this->last_touched_ts = $db_row->post_last_touched_ts; // When Item received last visible change (edit, comment, etc.) $this->creator_user_ID = $db_row->post_creator_user_ID; // Needed for history display $this->lastedit_user_ID = $db_row->post_lastedit_user_ID; // Needed for history display $this->assigned_user_ID = $db_row->post_assigned_user_ID; $this->dateset = $db_row->post_dateset; $this->status = $db_row->post_status; $this->content = $db_row->post_content; $this->titletag = $db_row->post_titletag; $this->pst_ID = $db_row->post_pst_ID; $this->datedeadline = $db_row->post_datedeadline; $this->priority = $db_row->post_priority; $this->locale = $db_row->post_locale; $this->wordcount = $db_row->post_wordcount; $this->notifications_status = $db_row->post_notifications_status; $this->notifications_ctsk_ID = $db_row->post_notifications_ctsk_ID; $this->comment_status = $db_row->post_comment_status; // Comments status $this->order = $db_row->post_order; $this->featured = $db_row->post_featured; $this->parent_ID = $db_row->post_parent_ID; // echo 'renderers=', $db_row->post_renderers; $this->renderers = $db_row->post_renderers; $this->excerpt = $db_row->post_excerpt; $this->excerpt_autogenerated = $db_row->post_excerpt_autogenerated; // Location if (!empty($db_row->post_ctry_ID)) { $this->ctry_ID = $db_row->post_ctry_ID; } if (!empty($db_row->post_rgn_ID)) { $this->rgn_ID = $db_row->post_rgn_ID; } if (!empty($db_row->post_subrg_ID)) { $this->subrg_ID = $db_row->post_subrg_ID; } if (!empty($db_row->post_city_ID)) { $this->city_ID = $db_row->post_city_ID; } } modules_call_method('constructor_item', array('Item' => &$this)); }
/** * Constructor * * @param object table Database row * @param string * @param string * @param string * @param string for derived classes * @param string datetime field name * @param string datetime field name * @param string User ID field name * @param string User ID field name */ function Item($db_row = NULL, $dbtable = 'T_items__item', $dbprefix = 'post_', $dbIDname = 'post_ID', $objtype = 'Item', $datecreated_field = 'datecreated', $datemodified_field = 'datemodified', $creator_field = 'creator_user_ID', $lasteditor_field = 'lastedit_user_ID') { global $localtimenow, $default_locale, $current_User; $this->priorities = array(1 => T_('1 - Highest'), 2 => T_('2 - High'), 3 => T_('3 - Medium'), 4 => T_('4 - Low'), 5 => T_('5 - Lowest')); // Call parent constructor: parent::ItemLight($db_row, $dbtable, $dbprefix, $dbIDname, $objtype, $datecreated_field, $datemodified_field, $creator_field, $lasteditor_field); if (is_null($db_row)) { // New item: if (isset($current_User)) { // use current user as default, if available (which won't be the case during install) $this->set_creator_User($current_User); } $this->set('notifications_status', 'noreq'); // Set the renderer list to 'default' will trigger all 'opt-out' renderers: $this->set('renderers', array('default')); $this->set('status', 'published'); $this->set('locale', $default_locale); $this->set('priority', 3); } else { $this->datecreated = $db_row->post_datecreated; // Needed for history display $this->creator_user_ID = $db_row->post_creator_user_ID; // Needed for history display $this->lastedit_user_ID = $db_row->post_lastedit_user_ID; // Needed for history display $this->assigned_user_ID = $db_row->post_assigned_user_ID; $this->status = $db_row->post_status; $this->content = $db_row->post_content; $this->pst_ID = $db_row->post_pst_ID; $this->datedeadline = $db_row->post_datedeadline; $this->priority = $db_row->post_priority; $this->locale = $db_row->post_locale; $this->wordcount = $db_row->post_wordcount; $this->notifications_status = $db_row->post_notifications_status; $this->notifications_ctsk_ID = $db_row->post_notifications_ctsk_ID; $this->comment_status = $db_row->post_comment_status; // Comments status // echo 'renderers=', $db_row->post_renderers; $this->renderers = $db_row->post_renderers; $this->views = $db_row->post_views; } }