本文整理汇总了PHP中false::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP false::getName方法的具体用法?PHP false::getName怎么用?PHP false::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类false
的用法示例。
在下文中一共展示了false::getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleUpload
/**
* Returns array('success'=>true) or array('error'=>'error message')
*/
public function handleUpload()
{
if (!$this->file) {
return array('error' => Tools::displayError('No files were uploaded.'));
}
$size = $this->file->getSize();
if ($size == 0) {
return array('error' => Tools::displayError('File is empty'));
}
if ($size > $this->sizeLimit) {
return array('error' => Tools::displayError('File is too large'));
}
$pathinfo = pathinfo($this->file->getName());
$these = implode(', ', $this->allowedExtensions);
if (!isset($pathinfo['extension'])) {
return array('error' => sprintf(Tools::displayError('File has an invalid extension, it should be one of these: %s.'), $these));
}
$ext = $pathinfo['extension'];
if ($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)) {
return array('error' => sprintf(Tools::displayError('File has an invalid extension, it should be one of these: %s.'), $these));
}
return $this->file->save();
}
示例2: getRepoName
/**
* Returns the name of the repository.
*
* @return string
*/
function getRepoName()
{
return $this->repo ? $this->repo->getName() : 'unknown';
}
示例3: getName
/**
* Returns the display name for the student.
*
* @since 0.1
*
* @return String
*/
public function getName()
{
return $this->getUser()->getRealName() === '' ? $this->user->getName() : $this->user->getRealName();
}
示例4: addMessage
/**
* @param string $text
* @param Mage_Customer_Model_Customer|Varien_Object|false $customer
* @param Mage_Admin_Model_User|false $user
* @param string $triggeredBy
* @param string $messageType
* @param bool|Mirasvit_Helpdesk_Model_Email $email
* @param bool|string $bodyFormat
*
* @return Mirasvit_Helpdesk_Model_Message
*
* @throws Exception
*/
public function addMessage($text, $customer, $user, $triggeredBy, $messageType = Mirasvit_Helpdesk_Model_Config::MESSAGE_PUBLIC, $email = false, $bodyFormat = false)
{
$message = Mage::getModel('helpdesk/message')->setTicketId($this->getId())->setType($messageType)->setBody($text)->setBodyFormat($bodyFormat)->setTriggeredBy($triggeredBy);
if ($triggeredBy == Mirasvit_Helpdesk_Model_Config::CUSTOMER) {
$message->setCustomerId($customer->getId());
$message->setCustomerName($customer->getName());
$message->setCustomerEmail($customer->getEmail());
$message->setIsRead(true);
$this->setLastReplyName($customer->getName());
} elseif ($triggeredBy == Mirasvit_Helpdesk_Model_Config::USER) {
$message->setUserId($user->getId());
if ($this->getOrigData('user_id') == $this->getData('user_id')) {
if ($messageType != Mirasvit_Helpdesk_Model_Config::MESSAGE_INTERNAL) {
$this->setUserId($user->getId());
// In case of different departments of ticket and owner, correct department id
$departments = Mage::getModel('helpdesk/department')->getCollection();
$departments->addUserFilter($user->getId())->addFieldToFilter('is_active', true);
if ($departments->count()) {
$this->_department = null;
$this->setDepartmentId($departments->getFirstItem()->getId());
}
}
}
$this->setLastReplyName($user->getName());
if ($message->isThirdParty()) {
$message->setThirdPartyEmail($this->getThirdPartyEmail());
}
} elseif ($triggeredBy == Mirasvit_Helpdesk_Model_Config::THIRD) {
$message->setThirdPartyEmail($this->getThirdPartyEmail());
if ($email) {
$this->setLastReplyName($email->getSenderNameOrEmail());
$message->setThirdPartyName($email->getSenderName());
}
}
if ($email) {
$message->setEmailId($email->getId());
}
//если тикет был закрыт, затем поступило сообщение от пользователя - мы его открываем
if ($triggeredBy != Mirasvit_Helpdesk_Model_Config::USER) {
if ($this->isClosed()) {
$status = Mage::getModel('helpdesk/status')->loadByCode(Mirasvit_Helpdesk_Model_Config::STATUS_OPEN);
$this->setStatusId($status->getId());
}
$this->setIsArchived(false);
}
$message->save();
if ($email) {
$email->setIsProcessed(true)->setAttachmentMessageId($message->getId())->save();
} else {
Mage::helper('helpdesk')->saveAttachments($message);
}
if (!$this->getIsSpam()) {
if ($this->getReplyCnt() == 0) {
Mage::helper('helpdesk/notification')->newTicket($this, $customer, $user, $triggeredBy, $messageType);
} else {
Mage::helper('helpdesk/notification')->newMessage($this, $customer, $user, $triggeredBy, $messageType);
}
}
$this->setReplyCnt($this->getReplyCnt() + 1);
if (!$this->getFirstReplyAt() && $user) {
$this->setFirstReplyAt(Mage::getSingleton('core/date')->gmtDate());
}
$this->setLastReplyAt(Mage::getSingleton('core/date')->gmtDate());
$this->save();
Mage::helper('helpdesk/history')->addMessage($this, $text, $triggeredBy, array('customer' => $customer, 'user' => $user, 'email' => $email), $messageType);
return $message;
}