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


PHP SibdietHelper::profileImage方法代码示例

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


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

示例1: save

 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success.
  *
  * @since   1.6
  */
 public function save($data)
 {
     $profileData = $data['profile'];
     // Save the profile data.
     $profileTable = $this->getTable('profile', 'SibdietTable');
     if (!$profileTable->save($profileData)) {
         $this->setError($this->getError());
         return false;
     }
     // Check profile user / Register user
     if (!$profileTable->users_id) {
         if ($userId = SibdietHelper::registerUser($profileTable)) {
             $object = new stdClass();
             $object->id = $profileTable->id;
             $object->users_id = $userId;
             $result = JFactory::getDbo()->updateObject('#__sibdiet_profiles', $object, 'id');
         }
     }
     $data['profiles_id'] = $profileTable->id;
     // Save Setdiet
     if (parent::save($data)) {
         if ($data['profile']['image']) {
             // Process profile image - Upload or Delete
             $imageUpload = SibdietHelper::profileImage($data['profiles_id']);
             if ($imageUpload !== true) {
                 $app->enqueueMessage($imageUpload, 'warning');
             }
         }
         return true;
     }
     return false;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:41,代码来源:setdiet.php

示例2: save

 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success.
  *
  * @since   1.6
  */
 public function save($data)
 {
     // Save Setdiet
     if (parent::save($data)) {
         if ($data['image']) {
             // Process profile image - Upload or Delete
             $imageUpload = SibdietHelper::profileImage($data['id'], '');
             if ($imageUpload !== true) {
                 $app->enqueueMessage($imageUpload, 'warning');
             }
         }
         return true;
     }
     return false;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:24,代码来源:profile.php

示例3: onUserAfterSave

 /**
  * saves user profile data
  *
  * @param   array    $data    entered user data
  * @param   boolean  $isNew   true if this is a new user
  * @param   boolean  $result  true if saving the user worked
  * @param   string   $error   error message
  *
  * @return bool
  */
 public function onUserAfterSave($data, $isNew, $result, $error)
 {
     // Unset sibdiet profile id for security that user can not set it
     unset($data['sibdiet']['id']);
     $userId = JArrayHelper::getValue($data, 'id', 0, 'int');
     if ($userId && $result && isset($data['sibdiet'])) {
         $data['sibdiet']['users_id'] = $userId;
         try {
             // Sanitize the birthday
             $data['sibdiet']['birthday'] = $this->date;
             $data['sibdiet']['fname'] = trim($data['sibdiet']['fname']);
             $data['sibdiet']['lname'] = trim($data['sibdiet']['lname']);
             $data['sibdiet']['city'] = trim($data['sibdiet']['city']);
             $data['sibdiet']['mobile'] = trim($data['sibdiet']['mobile']);
             // Prepare permissions
             if (JFactory::getUser()->get('isRoot') && JFactory::getApplication()->isAdmin()) {
                 if (isset($data['sibdiet']['permissions'])) {
                     $data['sibdiet']['permissions'] = implode(',', $data['sibdiet']['permissions']);
                 } else {
                     $data['sibdiet']['permissions'] = '';
                 }
             } else {
                 unset($data['sibdiet']['permissions']);
             }
             $object = (object) $data['sibdiet'];
             $db = JFactory::getDbo();
             $query = $db->getQuery(true)->select('id')->from($db->quoteName('#__sibdiet_profiles'))->where($db->quoteName('users_id') . ' = ' . $userId);
             $db->setQuery($query);
             if ($result = $db->loadResult()) {
                 $db->updateObject('#__sibdiet_profiles', $object, 'users_id');
                 $profileID = $result;
             } else {
                 if (empty($object->created_by)) {
                     $object->created_by = $userId;
                 }
                 $object->created = JFactory::getDate()->toSql();
                 $db->insertObject('#__sibdiet_profiles', $object);
                 $profileID = $db->insertid();
             }
             // Process profile image - Upload or Delete
             $imageUpload = SibdietHelper::profileImage($profileID, 'sibdiet');
             if ($imageUpload !== true) {
                 JFactory::getApplication()->enqueueMessage($imageUpload, 'warning');
             }
         } catch (RuntimeException $e) {
             $this->_subject->setError($e->getMessage());
             return false;
         }
     }
     return true;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:61,代码来源:sibdiet.php

示例4: save

 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function save($data)
 {
     $app = JFactory::getApplication();
     $params = JComponentHelper::getParams('com_sibdiet');
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $db = JFactory::getDbo();
     if (isset($data['profile']) && is_array($data['profile'])) {
         $profile_info = (object) $data['profile'];
         unset($profile_info->image);
     }
     if (isset($data['body']) && is_array($data['body'])) {
         $registry = new JRegistry();
         $registry->loadArray($data['body']);
         $data['body'] = (string) $registry;
     }
     if (isset($data['special']) && is_array($data['special'])) {
         $registry = new JRegistry();
         $registry->loadArray($data['special']);
         $data['special'] = (string) $registry;
     }
     if (isset($data['payment']) && is_array($data['payment'])) {
         // Get the parameters
         $params = JComponentHelper::getParams('com_sibdiet');
         $data['payment']['diet_price'] = $params->get('diet_price');
         if ($data['payment']['payment_type'] == 'ACCELERATION_CARDS') {
             if ($Authority = self::PaymentRequest($data)) {
                 $data['authority'] = $Authority;
                 $this->setState('request.authority', $Authority);
             } else {
                 return false;
             }
         }
         $registry = new JRegistry();
         $registry->loadArray($data['payment']);
         $data['payment'] = (string) $registry;
     }
     $pk = !empty($data['id']) ? $data['id'] : (int) $this->getState('request.id');
     if ($pk > 0) {
         // Check diet exist for the user
         $query = $db->getQuery(true)->select('s.profiles_id')->from('#__sibdiet_setdiets AS s')->join('LEFT', '#__sibdiet_profiles AS p ON s.profiles_id = p.id')->where('s.room1 IS NULL AND s.room2 IS NULL AND s.room3 IS NULL AND s.room4 IS NULL AND s.room5 IS NULL AND s.room6 IS NULL')->where('s.id = ' . $pk)->where('p.users_id = ' . $user->id);
         $db->setQuery($query);
         if ($result = $db->loadResult()) {
             $data['profiles_id'] = $profile_info->id = $result;
             $db->updateObject('#__sibdiet_profiles', $profile_info, 'id');
         }
     } else {
         // Check profile exist for the user
         $query = $db->getQuery(true)->select('id')->from('#__sibdiet_profiles')->where('users_id = ' . $user->id);
         $db->setQuery($query);
         if ($profile_id = $db->loadResult()) {
             $data['profiles_id'] = $profile_info->id = $profile_id;
             $db->updateObject('#__sibdiet_profiles', $profile_info, 'id');
         } else {
             $profile_info->created = $date->toSql();
             $profile_info->created_by = $profile_info->users_id = $user->id;
             $profile_info->email = $user->email;
             if ($db->insertObject('#__sibdiet_profiles', $profile_info, 'id')) {
                 $data['profiles_id'] = $profile_info->id;
             }
         }
         $data['request_way'] = 'frontend';
     }
     if (parent::save($data)) {
         // Process profile image - Upload or Delete
         $imageUpload = SibdietHelper::profileImage($data['profiles_id']);
         if ($imageUpload !== true) {
             $app->enqueueMessage($imageUpload, 'warning');
         }
         return true;
     }
     return false;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:82,代码来源:form.php


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