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


PHP COwnerHelper::emailCommunityAdmins方法代码示例

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


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

示例1: updateProfile

 /**
  * Updates user profile
  **/
 public function updateProfile()
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = JRequest::getCmd('view', $this->getName());
     $view = $this->getView($viewName, '', $viewType);
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     if (!$this->_isEnabled()) {
         echo JText::_('COM_COMMUNITY_MULTIPROFILE_IS_CURRENTLY_DISABLED');
         return;
     }
     $appsLib = CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $mainframe = JFactory::getApplication();
     $profileType = JRequest::getInt('profileType', 0);
     $model = $this->getModel('Profile');
     $my = CFactory::getUser();
     $data = $model->getEditableProfile($my->id, $profileType);
     $oldProfileType = $my->getProfileType();
     // If there is nothing to edit, we should just redirect
     if (empty($data['fields'])) {
         $multiprofile = JTable::getInstance('MultiProfile', 'CTable');
         $multiprofile->load($profileType);
         $my->_profile_id = $multiprofile->id;
         // Trigger before onProfileTypeUpdate
         $args = array();
         $args[] = $my->id;
         $args[] = $oldProfileType;
         $args[] = $multiprofile->id;
         $result = $appsLib->triggerEvent('onProfileTypeUpdate', $args);
         //CFactory::load( 'helpers' , 'owner' );
         // @rule: If profile requires approval, logout user and update block status. This is not
         // applicable to site administrators.
         if ($multiprofile->approvals && !COwnerHelper::isCommunityAdmin($my->id)) {
             $my->set('block', 1);
             //CFactory::load( 'helpers' , 'owner' );
             $subject = JText::sprintf('COM_COMMUNITY_USER_NEEDS_APPROVAL_SUBJECT', $my->name);
             $message = JText::sprintf('COM_COMMUNITY_USER_PROFILE_CHANGED_NEEDS_APPROVAL', $my->name, $my->email, $my->username, $multiprofile->name, CRoute::getExternalURL('index.php?option=com_community&view=profile&userid=' . $my->id));
             COwnerHelper::emailCommunityAdmins($subject, $message);
             // @rule: Logout user.
             $mainframe->logout();
         }
         $my->save();
         $mainframe->redirect(CRoute::_('index.php?option=com_community&view=multiprofile&task=profileupdated&profileType=' . $multiprofile->id, false));
     }
     if ($jinput->getMethod() == 'POST') {
         $model = $this->getModel('Profile');
         $values = array();
         $profileType = JRequest::getInt('profileType', 0, 'POST');
         //CFactory::load( 'libraries' , 'profile' );
         $profiles = $model->getAllFields(array('published' => '1'), $profileType);
         $errors = array();
         // Delete all user's existing profile values and re-add the new ones
         // @rule: Bind the user data
         foreach ($profiles as $key => $groups) {
             foreach ($groups->fields as $data) {
                 // Get value from posted data and map it to the field.
                 // Here we need to prepend the 'field' before the id because in the form, the 'field' is prepended to the id.
                 $postData = JRequest::getVar('field' . $data->id, '', 'POST');
                 $values[$data->id] = CProfileLibrary::formatData($data->type, $postData);
                 if (get_magic_quotes_gpc()) {
                     $values[$data->id] = stripslashes($values[$data->id]);
                 }
                 // @rule: Validate custom profile if necessary
                 if (!CProfileLibrary::validateField($data->id, $data->type, $values[$data->id], $data->required)) {
                     // If there are errors on the form, display to the user.
                     $message = JText::sprintf('COM_COMMUNITY_FIELD_CONTAIN_IMPROPER_VALUES', $data->name);
                     $mainframe->enqueueMessage($message, 'error');
                     $errors[] = true;
                 }
             }
         }
         // Rebuild new $values with field code
         $valuesCode = array();
         foreach ($values as $key => $val) {
             $fieldCode = $model->getFieldCode($key);
             if ($fieldCode) {
                 // For backward compatibility, we can't pass in an object. We need it to behave
                 // like 1.8.x where we only pass values.
                 $valuesCode[$fieldCode] = $val;
             }
         }
         $args = array();
         $args[] = $my->id;
         $args[] = $valuesCode;
         $saveSuccess = false;
         $result = $appsLib->triggerEvent('onBeforeProfileUpdate', $args);
         // make sure none of the $result is false
         if (!$result || !in_array(false, $result)) {
             $saveSuccess = true;
             $model->saveProfile($my->id, $values);
         }
         $mainframe = JFactory::getApplication();
         if (!$saveSuccess) {
             $mainframe->redirect(CRoute::_('index.php?option=com_community&view=multiprofile&task=updateProfile&profileType=' . $profileType, false), JText::_('COM_COMMUNITY_PROFILE_NOT_SAVED'), 'error');
         }
//.........这里部分代码省略.........
开发者ID:Jougito,项目名称:DynWeb,代码行数:101,代码来源:multiprofile.php

示例2: updateProfile

 /**
  * Updates user profile
  **/
 public function updateProfile()
 {
     $document =& JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = JRequest::getCmd('view', $this->getName());
     $view =& $this->getView($viewName, '', $viewType);
     if (!$this->_isEnabled()) {
         echo JText::_('CC MULTIPROFILE IS CURRENTLY DISABLED');
         return;
     }
     $mainframe =& JFactory::getApplication();
     $profileType = JRequest::getInt('profileType', 0);
     $model = $this->getModel('Profile');
     $my = CFactory::getUser();
     $data = $model->getEditableProfile($my->id, $profileType);
     // If there is nothing to edit, we should just redirect
     if (empty($data['fields'])) {
         $multiprofile =& JTable::getInstance('MultiProfile', 'CTable');
         $multiprofile->load($profileType);
         $my->_profile_id = $multiprofile->id;
         CFactory::load('helpers', 'owner');
         // @rule: If profile requires approval, logout user and update block status. This is not
         // applicable to site administrators.
         if ($multiprofile->approvals && !COwnerHelper::isCommunityAdmin($my->id)) {
             $my->set('block', 1);
             CFactory::load('helpers', 'owner');
             $subject = JText::sprintf('CC USER NEEDS APPROVAL SUBJECT', $my->name);
             $message = JText::sprintf('CC USER PROFILE CHANGED NEEDS APPROVAL', $my->name, $my->email, $my->username, $multiprofile->name, CRoute::getExternalURL('index.php?option=com_community&view=profile&userid=' . $my->id));
             COwnerHelper::emailCommunityAdmins($subject, $message);
             // @rule: Logout user.
             $mainframe->logout();
         }
         $my->save();
         $mainframe->redirect(CRoute::_('index.php?option=com_community&view=multiprofile&task=profileupdated&profileType=' . $multiprofile->id, false));
     }
     if (JRequest::getMethod() == 'POST') {
         $model = $this->getModel('Profile');
         $values = array();
         $profileType = JRequest::getInt('profileType', 0, 'POST');
         CFactory::load('libraries', 'profile');
         $profiles = $model->getAllFields(array('published' => '1', 'registration' => '1'), $profileType);
         $errors = array();
         $my = CFactory::getUser();
         // Delete all user's existing profile values and re-add the new ones
         // @rule: Bind the user data
         foreach ($profiles as $key => $groups) {
             foreach ($groups->fields as $data) {
                 // Get value from posted data and map it to the field.
                 // Here we need to prepend the 'field' before the id because in the form, the 'field' is prepended to the id.
                 $postData = JRequest::getVar('field' . $data->id, '', 'POST');
                 $values[$data->id] = CProfileLibrary::formatData($data->type, $postData);
                 // @rule: Validate custom profile if necessary
                 if (!CProfileLibrary::validateField($data->type, $values[$data->id], $data->required)) {
                     // If there are errors on the form, display to the user.
                     $message = JText::sprintf('CC FIELD CONTAIN IMPROPER VALUES', $data->name);
                     $mainframe->enqueueMessage($message, 'error');
                     $errors[] = true;
                 }
             }
         }
         $model->saveProfile($my->id, $values);
         $multiprofile =& JTable::getInstance('MultiProfile', 'CTable');
         $multiprofile->load($profileType);
         $my->_profile_id = $multiprofile->id;
         $mainframe =& JFactory::getApplication();
         CFactory::load('helpers', 'owner');
         // @rule: If profile requires approval, logout user and update block status. This is not
         // applicable to site administrators.
         if ($multiprofile->approvals && !COwnerHelper::isCommunityAdmin($my->id)) {
             $my->set('block', 1);
             CFactory::load('helpers', 'owner');
             $subject = JText::sprintf('CC USER NEEDS APPROVAL SUBJECT', $my->name);
             $message = JText::sprintf('CC USER PROFILE CHANGED NEEDS APPROVAL', $my->name, $my->email, $my->username, $multiprofile->name, CRoute::getExternalURL('index.php?option=com_community&view=profile&userid=' . $my->id));
             COwnerHelper::emailCommunityAdmins($subject, $message);
             // @rule: Logout user.
             $mainframe->logout();
         }
         $my->save();
         if (!in_array(true, $errors)) {
             $mainframe->redirect(CRoute::_('index.php?option=com_community&view=multiprofile&task=profileupdated&profileType=' . $multiprofile->id, false));
         }
     }
     echo $view->get(__FUNCTION__);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:87,代码来源:multiprofile.php


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