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


PHP CContact::bind方法代码示例

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


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

示例1: 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

示例2: die

<?php

/* CONTACTS $Id: do_contact_aed.php 5872 2009-04-25 00:09:56Z merlinyoda $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
$obj = new CContact();
$msg = '';
if (!$obj->bind($_POST)) {
    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
$del = dPgetParam($_POST, 'del', 0);
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Contact');
if ($del) {
    if ($msg = $obj->delete()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    } else {
        $AppUI->setMsg("deleted", UI_MSG_ALERT, true);
        $AppUI->redirect("m=contacts");
    }
} else {
    $isNotNew = @$_POST['contact_id'];
    if ($msg = $obj->store()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
    } else {
        $AppUI->setMsg($isNotNew ? 'updated' : 'added', UI_MSG_OK, true);
    }
    $AppUI->redirect();
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:31,代码来源:do_contact_aed.php

示例3: 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

示例4:

         $contactValues["contact_email"] = $ci['EMAIL'][0]['value'][0][0];
         $contactValues["contact_email2"] = $ci['EMAIL'][1]['value'][0][0];
         $contactValues["contact_phone"] = $ci['TEL'][0]['value'][0][0];
         $contactValues["contact_phone2"] = $ci['TEL'][1]['value'][0][0];
         $contactValues["contact_mobile"] = $ci['TEL'][2]['value'][0][0];
         $contactValues["contact_address1"] = $ci['ADR'][0]['value'][2][0];
         $contactValues["contact_address2"] = $ci['ADR'][0]['value'][1][0] . ', ' . $ci['ORG'][0]['value'][0][0];
         $contactValues["contact_city"] = $ci['ADR'][0]['value'][3][0];
         $contactValues["contact_state"] = $ci['ADR'][0]['value'][4][0];
         $contactValues["contact_zip"] = $ci['ADR'][0]['value'][5][0];
         $contactValues["contact_country"] = $ci['ADR'][0]['value'][6][0];
         $contactValues["contact_notes"] = $ci['NOTE'][0]['value'][0][0];
         $contactValues["contact_order_by"] = $contactValues["contact_last_name"] . ', ' . $contactValues["contact_first_name"];
         $contactValues["contact_id"] = 0;
         // bind array to object
         if (!$obj->bind($contactValues)) {
             $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
             $AppUI->redirect();
         }
         // store vCard data for this object
         if ($msg = $obj->store()) {
             $AppUI->setMsg($msg, UI_MSG_ERROR);
         }
     }
     // one or more vCard imports were successful
     $AppUI->setMsg('vCard(s) imported', UI_MSG_OK, true);
     $AppUI->redirect();
 } else {
     // redirect in case of file upload trouble
     $AppUI->setMsg("vCardFileUploadError", UI_MSG_ERROR);
     $AppUI->redirect();
开发者ID:n2i,项目名称:xvnkb,代码行数:31,代码来源:vcardimport.php

示例5: foreach

    echo $AppUI->_('Name');
    ?>
</th>
	<th><?php 
    echo $AppUI->_('e-mail');
    ?>
</th>
	<th><?php 
    echo $AppUI->_('Department');
    ?>
</th>
</tr>
<?php 
    foreach ($rows as $row) {
        $contact = new CContact();
        $contact->bind($row);
        $dept_detail = $contact->getDepartmentDetails();
        $s .= '<tr><td>';
        $s .= '<a href="?m=contacts&amp;a=view&amp;contact_id=' . dPformSafe($row['contact_id']) . '">' . htmlspecialchars($row['contact_last_name'] . ', ' . $row['contact_first_name']) . '</a>';
        $s .= '<td><a href="mailto:' . dPformSafe($row['contact_email'], DP_FORM_URI) . '">' . htmlspecialchars($row['contact_email']) . '</a></td>';
        $s .= '<td>' . htmlspecialchars($dept_detail['dept_name']) . '</td>';
        $s .= '</tr>';
    }
}
$s .= '<tr><td colspan="3" align="right" valign="top" style="background-color:#ffffff">';
$s .= '<input type="button" class=button value="' . $AppUI->_('new contact') . '" onclick="javascript:window.location=\'./index.php?m=contacts&amp;a=addedit&amp;company_id=' . dPformSafe($company_id) . '&amp;company_name=' . dPformSafe($obj->company_name) . '\'">';
$s .= '</td></tr>';
echo $s;
?>
</table>
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:30,代码来源:vw_contacts.php

示例6: executePut

 /**
  * Put Request Handler
  *
  * This method is called when a request is a PUT
  *
  * @return array
  */
 public function executePut()
 {
     $valid = $this->hasRequiredParameters($this->requiredParams);
     if ($valid instanceof Frapi_Error) {
         return $valid;
     }
     $username = $this->getParam('username');
     $password = $this->getParam('password');
     // Attempt to login as user, a little bit of a hack as we currently
     // require the $_POST['login'] var to be set as well as a global AppUI
     $AppUI = new CAppUI();
     $GLOBALS['AppUI'] = $AppUI;
     $_POST['login'] = 'login';
     if (!$AppUI->login($username, $password)) {
         throw new Frapi_Error('INVALID_LOGIN');
     }
     $post_data = array('contact_id' => 0, 'contact_first_name' => $this->getParam('contact_first_name'), 'contact_last_name' => $this->getParam('contact_last_name'), 'contact_order_by' => $this->getParam('contact_order_by'), 'contact_private' => $this->getParam('contact_private'), 'contact_job' => $this->getParam('contact_job'), 'contact_company_name' => $this->getParam('contact_company_name'), 'contact_company' => $this->getParam('contact_company'), 'contact_department_name' => $this->getParam('contact_department_name'), 'contact_department' => $this->getParam('contact_department'), 'contact_title' => $this->getParam('contact_title'), 'contact_type' => $this->getParam('contact_type'), 'contact_address1' => $this->getParam('contact_address1'), 'contact_address2' => $this->getParam('contact_address2'), 'contact_city' => $this->getParam('contact_city'), 'contact_state' => $this->getParam('contact_state'), 'contact_zip' => $this->getParam('contact_zip'), 'contact_country' => $this->getParam('contact_country'), 'contact_birthday' => $this->getParam('contact_birthday'), 'contact_notes' => $this->getParam('contact_notes'));
     // Ugh, the store method uses $_POST directly for contact methods :(
     $_POST['contact_methods'] = $this->getParam('contact_methods');
     $contact = new CContact();
     $contact->bind($post_data);
     $error_array = $contact->store($AppUI);
     if ($error_array !== true) {
         $error_message = '';
         foreach ($error_array as $error) {
             $error_message .= $error . '. ';
         }
         throw new Frapi_Error('SAVE_ERROR', $error_message);
     }
     /*
      * TODO: How do we handle extra fields?
      */
     $contact = (array) $contact;
     // Remove the data that is not for display
     unset($contact['tbl_prefix'], $contact['_tbl'], $contact['_tbl_key'], $contact['_error'], $contact['_query']);
     $this->data['contact'] = $contact;
     $this->data['success'] = true;
     return new Frapi_Response(array('code' => 201, 'data' => $this->data));
 }
开发者ID:robertbasic,项目名称:web2project-api,代码行数:46,代码来源:Contacts.php

示例7: testCanDelete

 public function testCanDelete()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store($AppUI);
     $cantDelete = $this->obj->canDelete('error', true);
     $this->assertFalse($cantDelete);
     $contact = new CContact();
     $contact->bind($this->post_data);
     $contact->contact_first_name = 'Firstname3';
     $contact->contact_last_name = 'Lastname3';
     $contact->contact_display_name = '';
     $result = $contact->store($AppUI);
     $canDeleteUser = $contact->canDelete('error');
     $this->assertTrue($canDeleteUser);
 }
开发者ID:eureka2,项目名称:web2project,代码行数:15,代码来源:contacts.test.php


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