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


PHP Social::isValid方法代码示例

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


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

示例1: updateSocial

 /**
  * Update the current walk with passed in form data
  * This also handles GPX data
  */
 public function updateSocial(array $formData)
 {
     $this->loadSocial($formData['id']);
     // Update all basic fields
     // Fields that can't be saved are just ignored
     // Invalid fields throw an exception - display this to the user and continue
     foreach ($formData as $name => $value) {
         try {
             $this->social->{$name} = $value;
         } catch (UnexpectedValueException $e) {
             echo "<p>";
             var_dump($name);
             var_dump($value);
             var_dump($e->getMessage());
             echo "</p>";
         }
     }
     // Empty checkboxes...
     if (empty($formData['showNormal'])) {
         $this->social->showNormal = false;
     }
     if (empty($formData['showNewMember'])) {
         $this->social->showNewMember = false;
     }
     // Time fields need to be built up (they combine date & time internally)
     if (!empty($formData['date'])) {
         if (!empty($formData['starttime'])) {
             $this->social->start = strtotime($formData['date'] . " " . $formData['starttime']);
         } else {
             $this->social->start = strtotime($formData['date']);
         }
         if (!empty($formData['endtime'])) {
             $this->social->end = strtotime($formData['date'] . " " . $formData['endtime']);
         } else {
             if ($formData['endtime'] == "") {
                 $this->social->end = null;
             }
         }
     }
     if (!empty($formData['newMemberStart'])) {
         $this->social->newMemberStart = strtotime($formData['date'] . " " . $formData['newMemberStart']);
     }
     if (!empty($formData['newMemberEnd'])) {
         $this->social->newMemberEnd = strtotime($formData['date'] . " " . $formData['newMemberEnd']);
     }
     // Alterations
     $this->social->alterations->incrementVersion();
     $this->social->alterations->setDetails($formData['alterations_details']);
     $this->social->alterations->setCancelled($formData['alterations_cancelled']);
     $this->social->alterations->setPlaceTime($formData['alterations_placeTime']);
     $this->social->alterations->setOrganiser($formData['alterations_organiser']);
     $this->social->alterations->setDate($formData['alterations_date']);
     if ($this->social->isValid()) {
         $this->social->save();
         // Redirect to the list page
         $itemid = JRequest::getInt('returnPage');
         if (empty($itemid)) {
             return false;
         }
         $item = JFactory::getApplication()->getMenu()->getItem($itemid);
         $link = new JURI("/" . $item->route);
         // Jump to the event?
         if (JRequest::getBool('jumpToEvent')) {
             $link->setFragment("social_" . $this->social->id);
         }
         JFactory::getApplication()->redirect($link, "Social saved");
     } else {
         // Find out why it's invalid.
         // All other errors should be caught by JS - just check it's either a normal social or a new members one.
         if (!$this->social->showNormal && !$this->social->showNewMember) {
         }
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:77,代码来源:addeditsocial.php


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