. * */ function contacts_namesort($a,$b){ return strcmp($a['fullname'],$b['fullname']); } // Init owncloud require_once('../../lib/base.php'); // Check if we are a user OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); // Get active address books. This creates a default one if none exists. $ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser()); $contacts = OC_Contacts_VCard::all($ids); $addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser()); // Load the files we need OC_App::setActiveNavigationEntry( 'contacts_index' ); // Load a specific user? $id = isset( $_GET['id'] ) ? $_GET['id'] : null; $details = array(); // FIXME: This cannot work..? if(is_null($id) && count($contacts) > 0) { $id = $contacts[0]['id']; } if(!is_null($id)) { $vcard = OC_Contacts_App::getContactVCard($id); $details = OC_Contacts_VCard::structureContact($vcard); } // if( !is_null($id)/* || count($contacts)*/){ // if(is_null($id)) $id = $contacts[0]['id']; // $vcard = OC_Contacts_App::getContactVCard($id); // $details = OC_Contacts_VCard::structureContact($vcard); // } // Include Style and Script OC_Util::addScript('contacts','interface'); OC_Util::addScript('contacts','jquery.inview'); OC_Util::addScript('', 'jquery.multiselect'); OC_Util::addStyle('contacts','styles'); //OC_Util::addStyle('contacts','formtastic'); $property_types = OC_Contacts_App::getAddPropertyOptions(); $adr_types = OC_Contacts_App::getTypesOfProperty('ADR'); $phone_types = OC_Contacts_App::getTypesOfProperty('TEL'); // Process the template $tmpl = new OC_Template( 'contacts', 'index', 'user' ); $tmpl->assign('property_types',$property_types); $tmpl->assign('adr_types',$adr_types); $tmpl->assign('phone_types',$phone_types); $tmpl->assign('addressbooks', $addressbooks); $tmpl->assign('contacts', $contacts); $tmpl->assign('details', $details ); $tmpl->assign('id',$id); $tmpl->printPage();