Reduce variables assigned.
This commit is contained in:
parent
50462903d6
commit
7cb74a0bf3
|
@ -14,28 +14,18 @@ OCP\App::checkAppEnabled('contacts');
|
||||||
|
|
||||||
// Get active address books. This creates a default one if none exists.
|
// Get active address books. This creates a default one if none exists.
|
||||||
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
|
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
|
||||||
$contacts = OC_Contacts_VCard::all($ids);
|
$has_contacts = (count(OC_Contacts_VCard::all($ids, 0, 1)) > 0 ? true : false); // just to check if there are any contacts.
|
||||||
if($contacts === false) {
|
if($contacts === false) {
|
||||||
OCP\Util::writeLog('contacts','index.html: No contacts found.',OCP\Util::DEBUG);
|
OCP\Util::writeLog('contacts','index.html: No contacts found.',OCP\Util::DEBUG);
|
||||||
}
|
}
|
||||||
|
error_log('activeIds: '.print_r($activeIds, true));
|
||||||
$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
|
error_log('has_contacts: '.$has_contacts);
|
||||||
|
|
||||||
// Load the files we need
|
// Load the files we need
|
||||||
OCP\App::setActiveNavigationEntry( 'contacts_index' );
|
OCP\App::setActiveNavigationEntry( 'contacts_index' );
|
||||||
|
|
||||||
// Load a specific user?
|
// Load a specific user?
|
||||||
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
|
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
|
||||||
$details = array();
|
|
||||||
|
|
||||||
if(is_null($id) && count($contacts) > 0) {
|
|
||||||
$id = $contacts[0]['id'];
|
|
||||||
}
|
|
||||||
unset($contacts);
|
|
||||||
if(!is_null($id)) {
|
|
||||||
$vcard = OC_Contacts_App::getContactVCard($id);
|
|
||||||
$details = OC_Contacts_VCard::structureContact($vcard);
|
|
||||||
}
|
|
||||||
$property_types = OC_Contacts_App::getAddPropertyOptions();
|
$property_types = OC_Contacts_App::getAddPropertyOptions();
|
||||||
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
|
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
|
||||||
$email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
|
$email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
|
||||||
|
@ -69,7 +59,6 @@ $tmpl->assign('property_types', $property_types);
|
||||||
$tmpl->assign('phone_types', $phone_types);
|
$tmpl->assign('phone_types', $phone_types);
|
||||||
$tmpl->assign('email_types', $email_types);
|
$tmpl->assign('email_types', $email_types);
|
||||||
$tmpl->assign('categories', $categories);
|
$tmpl->assign('categories', $categories);
|
||||||
$tmpl->assign('addressbooks', $addressbooks);
|
$tmpl->assign('has_contacts',$has_contacts);
|
||||||
$tmpl->assign('details', $details );
|
|
||||||
$tmpl->assign('id',$id);
|
$tmpl->assign('id',$id);
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
|
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
|
||||||
<?php
|
<?php
|
||||||
if ($_['id']){
|
if($_['has_contacts']){
|
||||||
echo $this->inc('part.contact');
|
echo $this->inc('part.contact');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
Loading…
Reference in New Issue