当前位置: 首页>>代码示例>>PHP>>正文


PHP CContact类代码示例

本文整理汇总了PHP中CContact的典型用法代码示例。如果您正苦于以下问题:PHP CContact类的具体用法?PHP CContact怎么用?PHP CContact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CContact类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Import

 /**
  * @param int $iUserId
  * @param string $sTempFileName
  * @param int $iParsedCount
  * @return int
  */
 public function Import($iUserId, $sTempFileName, &$iParsedCount)
 {
     $iCount = -1;
     $iParsedCount = 0;
     if (file_exists($sTempFileName)) {
         $aCsv = api_Utils::CsvToArray($sTempFileName);
         if (is_array($aCsv)) {
             $iCount = 0;
             foreach ($aCsv as $aCsvItem) {
                 set_time_limit(30);
                 $this->oParser->Reset();
                 $oContact = new CContact();
                 $oContact->IdUser = $iUserId;
                 $this->oParser->SetContainer($aCsvItem);
                 $aParameters = $this->oParser->GetParameters();
                 foreach ($aParameters as $sPropertyName => $mValue) {
                     if ($oContact->IsProperty($sPropertyName)) {
                         $oContact->{$sPropertyName} = $mValue;
                     }
                 }
                 if (0 === strlen($oContact->FullName)) {
                     $oContact->FullName = trim($oContact->FirstName . ' ' . $oContact->LastName);
                 }
                 $iParsedCount++;
                 $oContact->__SKIP_VALIDATE__ = true;
                 if ($this->oApiContactsManager->CreateContact($oContact)) {
                     $iCount++;
                 }
                 unset($oContact, $aParameters, $aCsvItem);
             }
         }
     }
     return $iCount;
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:40,代码来源:csv.php

示例2: testStoreCreate

 /**
  * Tests the proper creation of a user & contact
  */
 public function testStoreCreate()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $contact = new CContact();
     $contact->overrideDatabase($this->mockDB);
     $contact->bind($this->post_data);
     $result = $contact->store();
     $this->assertTrue($result);
     $this->assertNotEquals(0, $contact->contact_id);
     $this->obj->user_contact = $contact->contact_id;
     $result = $this->obj->store();
     $this->assertTrue($result);
     $this->assertNotEquals(0, $this->obj->user_id);
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:18,代码来源:CUsersTest.php

示例3: addField

 public function addField($fieldName, $fieldValue)
 {
     if ('' == $fieldValue) {
         return '-';
     }
     $pieces = explode('_', $fieldName);
     $suffix = end($pieces);
     switch ($suffix) {
         case 'datetime':
             $myDate = intval($fieldValue) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($fieldValue, '%Y-%m-%d %T')) : null;
             $output = $myDate ? $myDate->format($this->dtf) : '-';
             break;
         case 'email':
             $output = w2p_email($fieldValue);
             break;
         case 'url':
             $value = str_replace(array('"', '"', '<', '>'), '', $fieldValue);
             $output = w2p_url($value);
             break;
         case 'owner':
             if (!$fieldValue) {
                 return '-';
             }
             $obj = new CContact();
             $obj->findContactByUserid($fieldValue);
             $link = '?m=users&a=view&user_id=' . $fieldValue;
             $output = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>';
             break;
         case 'percent':
             $output = round($fieldValue) . '%';
             break;
         case 'description':
             $output = w2p_textarea($fieldValue);
             break;
         case 'company':
         case 'department':
         case 'project':
             $class = 'C' . ucfirst($suffix);
             $obj = new $class();
             $obj->load($fieldValue);
             $link = '?m=' . w2p_pluralize($suffix) . '&a=view&' . $suffix . '_id=' . $fieldValue;
             $output = '<a href="' . $link . '">' . $obj->{"{$suffix}" . '_name'} . '</a>';
             break;
         default:
             $output = htmlspecialchars($fieldValue, ENT_QUOTES);
     }
     return $output;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:48,代码来源:ViewHelper.class.php

示例4: Import

 /**
  * @param int $iUserId
  * @param string $sTempFileName
  * @param int $iParsedCount
  * @param int $iGroupId
  * @param bool $bIsShared
  * @return int
  */
 public function Import($iUserId, $sTempFileName, &$iParsedCount, $iGroupId, $bIsShared)
 {
     $iCount = -1;
     $iParsedCount = 0;
     if (file_exists($sTempFileName)) {
         $aCsv = api_Utils::CsvToArray($sTempFileName);
         if (is_array($aCsv)) {
             $oApiUsersManager = CApi::Manager('users');
             $oAccount = $oApiUsersManager->GetDefaultAccount($iUserId);
             $iCount = 0;
             foreach ($aCsv as $aCsvItem) {
                 set_time_limit(30);
                 $this->oParser->Reset();
                 $oContact = new CContact();
                 $oContact->IdUser = $iUserId;
                 $this->oParser->SetContainer($aCsvItem);
                 $aParameters = $this->oParser->GetParameters();
                 foreach ($aParameters as $sPropertyName => $mValue) {
                     if ($oContact->IsProperty($sPropertyName)) {
                         $oContact->{$sPropertyName} = $mValue;
                     }
                 }
                 if (0 === strlen($oContact->FullName)) {
                     $oContact->FullName = trim($oContact->FirstName . ' ' . $oContact->LastName);
                 }
                 if (0 !== strlen($oContact->HomeEmail)) {
                     $oContact->PrimaryEmail = \EPrimaryEmailType::Home;
                     $oContact->ViewEmail = $oContact->HomeEmail;
                 } else {
                     if (0 !== strlen($oContact->BusinessEmail)) {
                         $oContact->PrimaryEmail = \EPrimaryEmailType::Business;
                         $oContact->ViewEmail = $oContact->BusinessEmail;
                     } else {
                         if (0 !== strlen($oContact->OtherEmail)) {
                             $oContact->PrimaryEmail = \EPrimaryEmailType::Other;
                             $oContact->ViewEmail = $oContact->OtherEmail;
                         }
                     }
                 }
                 if (strlen($oContact->BirthdayYear) === 2) {
                     $oDt = DateTime::createFromFormat('y', $oContact->BirthdayYear);
                     $oContact->BirthdayYear = $oDt->format('Y');
                 }
                 $iParsedCount++;
                 $oContact->__SKIP_VALIDATE__ = true;
                 if ($oAccount) {
                     $oContact->IdDomain = $oAccount->IdDomain;
                     $oContact->IdTenant = $oAccount->IdTenant;
                 }
                 $oContact->SharedToAll = $bIsShared;
                 $oContact->GroupsIds = array($iGroupId);
                 if ($this->oApiContactsManager->CreateContact($oContact)) {
                     $iCount++;
                 }
                 unset($oContact, $aParameters, $aCsvItem);
             }
         }
     }
     return $iCount;
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:68,代码来源:csv.php

示例5: getContactByWhere

 /**
  * @param string $sWhere
  * @param bool $bIgnoreHideInGab = false
  * @param int $iSharedTenantId = null
  * @return string
  */
 protected function getContactByWhere($sWhere, $bIgnoreHideInGab = false, $iSharedTenantId = null)
 {
     $aMap = api_AContainer::DbReadKeys(CContact::GetStaticMap());
     $aMap = array_map(array($this, 'escapeColumn'), $aMap);
     $sShared = is_int($iSharedTenantId) ? 'AND shared_to_all = 1' : 'AND shared_to_all = 0';
     $sHideInGab = $bIgnoreHideInGab ? '' : ' AND hide_in_gab = 0';
     $sSql = 'SELECT %s FROM %sawm_addr_book WHERE deleted = 0 AND auto_create = 0 ' . $sShared . $sHideInGab . ' AND %s';
     return sprintf($sSql, implode(', ', $aMap), $this->Prefix(), $sWhere);
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:15,代码来源:command_creator.php

示例6: testLoad

 public function testLoad()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $this->assertTrue($result);
     $item = new CContact();
     $item->overrideDatabase($this->mockDB);
     $this->post_data['contact_id'] = $this->obj->contact_id;
     $this->mockDB->stageHash($this->post_data);
     $item->load($this->obj->contact_id);
     $this->assertEquals($this->obj->contact_first_name, $item->contact_first_name);
     $this->assertEquals($this->obj->contact_last_name, $item->contact_last_name);
     $this->assertEquals($this->obj->contact_display_name, $item->contact_display_name);
     $this->assertEquals($this->obj->contact_company, $item->contact_company);
     $this->assertEquals($this->obj->contact_department, $item->contact_department);
     $this->assertEquals($this->obj->contact_icon, $item->contact_icon);
     $this->assertEquals($this->obj->contact_owner, $item->contact_owner);
     $this->assertEquals($this->obj->contact_id, $item->contact_id);
 }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例7: isset

<?php

/* ADMIN $Id: do_user_aed.php,v 1.13 2005/03/11 00:46:46 gregorerhardt Exp $ */
include $AppUI->getModuleClass('contacts');
$del = isset($_REQUEST['del']) ? $_REQUEST['del'] : FALSE;
$obj = new CUser();
$contact = new CContact();
if (!$obj->bind($_POST)) {
    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
if (!$contact->bind($_POST)) {
    $AppUI->setMsg($contact->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('User');
// !User's contact information not deleted - left for history.
if ($del) {
    if ($msg = $obj->delete()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    } else {
        $AppUI->setMsg("deleted", UI_MSG_ALERT, true);
        $AppUI->redirect('', -1);
    }
    return;
}
$isNewUser = !$_REQUEST['user_id'];
if ($isNewUser) {
    // check if a user with the param Username already exists
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:31,代码来源:do_user_aed.php

示例8: CUser

                $contact->contact_private = 1;
                $contact->store();
            }
        }
    } else {
        $AppUI->setMsg('failed to delete role', UI_MSG_ERROR);
    }
} else {
    if ($user_role) {
        $public_contact = false;
        if (dPgetConfig('user_contact_activate') && !$perms->checkLogin($user_id)) {
            $public_contact = true;
        }
        if ($perms->insertUserRole($user_role, $user_id)) {
            $AppUI->setMsg('added', UI_MSG_OK, true);
            if ($public_contact) {
                // Mark contact as public
                $obj = new CUser();
                $contact = new CContact();
                $obj->load($user_id);
                if ($contact->load($obj->user_contact)) {
                    $contact->contact_private = 0;
                    $contact->store();
                }
            }
        } else {
            $AppUI->setMsg('failed to add role', UI_MSG_ERROR);
        }
    }
}
$AppUI->redirect();
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:31,代码来源:do_userrole_aed.php

示例9: elseif

    $AppUI->setState('UserIdxWhere', '');
} elseif (isset($_POST['search_string'])) {
    $AppUI->setState('UserIdxWhere', $_POST['search_string']);
    $AppUI->setState('UserIdxStub', '');
}
$stub = $AppUI->getState('UserIdxStub');
$where = $AppUI->getState('UserIdxWhere');
$where = w2PformSafe($where, true);
if (isset($_GET['orderby'])) {
    $AppUI->setState('UserIdxOrderby', w2PgetParam($_GET, 'orderby', null));
}
$orderby = $AppUI->getState('UserIdxOrderby') ? $AppUI->getState('UserIdxOrderby') : 'user_username';
$orderby = $tab == 3 || $orderby != 'date_time_in' && $orderby != 'user_ip' ? $orderby : 'user_username';
// Pull First Letters
$letters = CUser::getFirstLetters();
$letters = $letters . CContact::getFirstLetters($AppUI->user_id, true);
$a2z = '<a href="./index.php?m=users&stub=0">' . $AppUI->_('All') . '</a>&nbsp;&nbsp;&nbsp;&nbsp;';
for ($c = 65; $c < 91; $c++) {
    $cu = chr($c);
    $cell = !(mb_strpos($letters, $cu) === false) ? '<a href="?m=users&stub=' . $cu . '">' . $cu . '</a>' : '<font color="#999999">' . $cu . '</font>';
    $a2z .= $cell . '&nbsp;';
}
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('User Management', 'icon.png', $m);
$titleBlock->addSearchCell($where);
$titleBlock->addCell($a2z);
$titleBlock->addButton('New user', '?m=users&a=addedit');
$titleBlock->show();
?>
<script language="javascript" type="text/javascript">
<?php 
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:index.php

示例10: header

    }
} else {
    header('Location: newuser.php?msg=spam');
}
if (w2PgetConfig('activate_external_user_creation') != 'true') {
    die('You should not access this file directly');
}
$username = w2PgetParam($_POST, 'user_username', 0);
$username = preg_replace("/[^A-Za-z0-9]/", "", $username);
$user = new CAdmin_User();
$result = $user->loadAll(null, "user_username = '{$username}'");
if (count($result)) {
    header('Location: newuser.php?msg=existing-user');
}
$email = w2PgetParam($_POST, 'contact_email', 0);
$contact = new CContact();
$result = $contact->loadAll(null, "contact_email = '{$email}'");
if (count($result)) {
    header('Location: newuser.php?msg=existing-email');
}
if (!$user->bind($_POST)) {
    $AppUI->setMsg($user->getError(), UI_MSG_ERROR);
    header('Location: newuser.php?msg=user');
}
if (!$contact->bind($_POST)) {
    $AppUI->setMsg($contact->getError(), UI_MSG_ERROR);
    header('Location: newuser.php?msg=contact');
}
$result = $contact->store();
if (count($contact->getError())) {
    header('Location: newuser.php?msg=contact');
开发者ID:illuminate3,项目名称:web2project,代码行数:31,代码来源:do_user_aed.php

示例11: isset

}
$del = isset($_REQUEST['del']) ? w2PgetParam($_REQUEST, 'del', false) : false;
$notify_new_user = isset($_POST['notify_new_user']) ? $_POST['notify_new_user'] : 0;
$perms =& $AppUI->acl();
if (!$perms->checkModule('admin', 'edit')) {
    $AppUI->redirect('m=public&a=access_denied');
}
if (!$perms->checkModule('users', 'edit')) {
    $AppUI->redirect('m=public&a=access_denied');
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Roles');
if ($_REQUEST['user_id']) {
    $user = new CUser();
    $user->load($_REQUEST['user_id']);
    $contact = new CContact();
    $contact->load($user->user_contact);
}
if ($del) {
    if ($perms->deleteUserRole(w2PgetParam($_REQUEST, 'role_id', 0), w2PgetParam($_REQUEST, 'user_id', 0))) {
        $AppUI->setMsg('deleted', UI_MSG_ALERT, true);
        $AppUI->redirect();
    } else {
        $AppUI->setMsg('failed to delete role', UI_MSG_ERROR);
        $AppUI->redirect();
    }
    return;
}
if (isset($_REQUEST['user_role']) && $_REQUEST['user_role']) {
    if ($perms->insertUserRole($_REQUEST['user_role'], $_REQUEST['user_id'])) {
        if ($notify_new_user) {
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:do_userrole_aed.php

示例12: die

<?php

/* CONTACTS $Id: view.php 6200 2013-01-15 06:24:08Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
$contact_id = intval(dPgetParam($_GET, 'contact_id', 0));
$AppUI->savePlace();
// load the record data
$msg = '';
$row = new CContact();
$canDelete = $row->canDelete($msg, $contact_id);
// Don't allow to delete contacts, that have a user associated to them.
$q = new DBQuery();
$q->addTable('users');
$q->addQuery('user_id');
$q->addWhere('user_contact = ' . $contact_id);
$sql = $q->prepare();
$q->clear();
$tmp_user = db_loadResult($sql);
if (!empty($tmp_user)) {
    $canDelete = false;
}
$canEdit = getPermission($m, 'edit', $contact_id);
if (!$row->load($contact_id) && $contact_id > 0) {
    $AppUI->setMsg('Contact');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
} else {
    if ($row->contact_private && $row->contact_owner != $AppUI->user_id && $row->contact_owner && $contact_id != 0) {
        $AppUI->redirect('m=public&a=access_denied');
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:31,代码来源:view.php

示例13: canEdit

// check permissions for this record
$canEdit = canEdit('system');
// Check permissions
if (!$canEdit && $user_id != $AppUI->user_id) {
    $AppUI->redirect('m=public&a=access_denied');
}
// load the preferences
$q = new w2p_Database_Query();
$q->addTable('user_preferences');
$q->addQuery('pref_name, pref_value');
$q->addWhere('pref_user = ' . (int) $user_id);
$prefs = $q->loadHashList();
$q->clear();
// get the user name
if ($user_id) {
    $user = CContact::getContactByUserid($user_id);
} else {
    $user = 'Default';
}
$titleBlock = new w2p_Theme_TitleBlock('Edit User Preferences', 'myevo-weather.png', $m, $m . '.' . $a);
$perms =& $AppUI->acl();
if ($canEdit) {
    $titleBlock->addCrumb('?m=system', 'system admin');
    $titleBlock->addCrumb('?m=system&a=systemconfig', 'system configuration');
}
$titleBlock->show();
?>
<script language="javascript" type="text/javascript">
function submitIt() {
	var form = document.changeuser;
	// Collate the checked states of the task log stuff
开发者ID:,项目名称:,代码行数:31,代码来源:

示例14: afterWriteContent

 function afterWriteContent($path, \Sabre\DAV\IFile $node)
 {
     if ($node instanceof \Sabre\CardDAV\ICard) {
         $iUserId = $this->server->getUser();
         if (isset($iUserId)) {
             $iTenantId = $node instanceof \Afterlogic\DAV\CardDAV\SharedCard ? 0 : null;
             $sContactFileName = $node->getName();
             $oContactDb = $this->oApiContactsManager->getContactByStrId($iUserId, $sContactFileName, $iTenantId);
             if (!isset($oContactDb)) {
                 $oVCard = \Sabre\VObject\Reader::read($node->get(), \Sabre\VObject\Reader::OPTION_IGNORE_INVALID_LINES);
                 if ($oVCard && $oVCard->UID) {
                     $oContactDb = $this->oApiContactsManager->getContactByStrId($iUserId, (string) $oVCard->UID . '.vcf', $iTenantId);
                 }
             }
             $oContact = new \CContact();
             $oContact->InitFromVCardStr($iUserId, $node->get());
             $oContact->IdContactStr = $sContactFileName;
             $oContact->IdTenant = $iTenantId;
             if (isset($oContactDb)) {
                 $oContact->IdContact = $oContactDb->IdContact;
                 $oContact->IdDomain = $oContactDb->IdDomain;
                 $oContact->SharedToAll = !!$oContactDb->SharedToAll;
                 $this->oApiContactsManager->updateContact($oContact);
             } else {
                 $this->oApiContactsManager->createContact($oContact);
             }
         }
     }
 }
开发者ID:afterlogic,项目名称:dav,代码行数:29,代码来源:Plugin.php

示例15: intval

echo $AppUI->_($message_id ? 'Edit Message' : 'Add Message');
?>
</strong></th>
        </tr>
        <?php 
if ($message_parent >= 0) {
    //check if this is a reply-post; if so, printout the original message
    $date = intval($message->message_date) ? new w2p_Utilities_Date($message->message_date) : new w2p_Utilities_Date();
    ?>
            <tr>
                <td align="right"><?php 
    echo $AppUI->_('Author');
    ?>
:</td>
                <td align="left"><?php 
    echo CContact::getContactByUserid($message->message_author);
    ?>
 (<?php 
    echo $AppUI->formatTZAwareTime($message->message_date, $df . ' ' . $tf);
    ?>
)</td>
            </tr>
            <tr><td align="right"><?php 
    echo $AppUI->_('Subject');
    ?>
:</td><td align="left"><?php 
    echo $message->message_title;
    ?>
</td></tr>
            <tr><td align="right" valign="top"><?php 
    echo $AppUI->_('Message');
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:post_message.php


注:本文中的CContact类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。