Added : Auto Collection Creation if no collection is found

Fixed : getProfileItem method
Added : file_directory update query
Updated : cb_install/sql/upgrade_3.0.sql
This commit is contained in:
Fawaz 2012-12-18 12:11:12 +00:00
parent 41109532fd
commit b99a663e95
4 changed files with 24 additions and 5 deletions

View file

@ -189,3 +189,6 @@ CREATE TABLE IF NOT EXISTS `{tbl_prefix}notifications` (
`send_email` enum('yes','no') NOT NULL DEFAULT 'yes',
PRIMARY KEY (`notification_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--12-18-2012 @author : Fawaz
ALTER TABLE `{tbl_prefix}photos` ADD `file_directory` VARCHAR( 25 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `view_exif`

View file

@ -867,6 +867,10 @@ class Collections extends CBCategory
$query_field[] = "active";
$query_val[] = "yes";
// type
$query_field[] = 'type';
$query_val[] = 'photos';
$insert_id = $db->insert(tbl($this->section_tbl),$query_field,$query_val);
addFeed(array('action'=>'add_collection','object_id' => $insert_id,'object'=>'collection'));

View file

@ -1214,10 +1214,22 @@ class CBPhotos {
$p['type'] = "photos";
{
$collections = $this->collection->get_collections( $p );
if ( !$collections ) {
global $cbcollection;
$collection_details['collection_name'] = $collection_details['collection_description'] = lang('Untitled Collection');
$collection_details['collection_tags'] = lang('untitled, collection'); $collection_details['category'] = array ( $cbcollection->get_default_cid() );
// Update following to have default values
$collection_details['broadcast'] = 'public'; $collection_details['allow_comments'] = 'yes'; $collection_details['public_upload'] = 'no';
$collection_insert_id = $cbcollection->create_collection( $collection_details );
$collection_details['collection_id'] = $collection_insert_id;
$collections[0] = $collection_details;
//pr( $collections, true );
}
$cl_array = $this->parse_array( $collections );
$collection = $array['collection_id'];
}
$this->unique = rand( 0, 9999 );
$fields =
array
(

View file

@ -822,7 +822,7 @@ function join_collection_table() {
$join = ' LEFT JOIN '.( $c ).' ON '.( $p.'.collection_id' ). ' = '.( $c.'.collection_id' );
//$alias = ", $p.userid as userid, $p.views as views, $p.allow_comments as allow_comments, $p.allow_rating as allow_rating, $p.total_comments as total_comments, $p.date_added as date_added, $p.rating as rating, $p.rated_by as rated_by, $p.voters as voters, $p.featured as featured, $p.broadcast as broadcast, $p.active as active";
//$alias .= ", $c.collection_name as collection_name, $c.userid as cuserid, $c.views as cviews, $c.allow_comments as callow_comments, $c.allow_rating as callow_rating, $c.total_comments as ctotal_comments, $c.date_added as cdate_added, $c.rating as crating, $c.rated_by as crated_by, $c.voters as cvoters, $c.featured as cfeatured, $c.broadcast as cbroadcast, $c.active as cactive, $c.cover_photo";
$alias = ", $c.collection_name, $c.cover_photo, $c.category";
$alias = ", $c.collection_name, $c.cover_photo, $c.category, $c.broadcast";
return array( $join, $alias );
}
@ -955,7 +955,7 @@ function get_photo_date_folder ( $pid ) {
$date_dir = false;
} else {
// Update the db value
//$db->update( tbl('photos'), array('file_directory'), array($date_dir), " photo_id = '".$photo['photo_id']."' " );
$db->update( tbl('photos'), array('file_directory'), array($date_dir), " photo_id = '".$photo['photo_id']."' " );
}
}