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


PHP Record::findByIdFrom方法代码示例

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


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

示例1: remove_404

 function remove_404($id)
 {
     // find the user to delete
     if ($error = Record::findByIdFrom('Redirector404s', $id)) {
         if ($error->delete()) {
             Flash::set('success', __('404 Error has been deleted!'));
         } else {
             Flash::set('error', __('There was a problem deleting this 404 error!'));
         }
     } else {
         Flash::set('error', __('404 Error not found!'));
     }
     redirect(get_url('plugin/redirector/'));
 }
开发者ID:julpi,项目名称:FreshCMS,代码行数:14,代码来源:RedirectorController.php

示例2: unapprove

 function unapprove($id)
 {
     // find the user to unapprove
     if ($comment = Record::findByIdFrom('Comment', $id)) {
         $comment->is_approved = 0;
         if ($comment->save()) {
             Flash::set('success', __('Comment has been unapproved!'));
             Observer::notify('comment_after_unapprove', $comment);
         }
     } else {
         Flash::set('error', __('Comment not found!'));
     }
     redirect(get_url('plugin/comment'));
 }
开发者ID:albertobraschi,项目名称:toad,代码行数:14,代码来源:CommentController.php

示例3: delete

 function delete()
 {
     $this->_checkPermission();
     $paths = func_get_args();
     $id = urldecode(join('/', $paths));
     $homeimage = Record::findByIdFrom('HomeImage', $id);
     //Remove folders and all images
     $dir = FILES_DIR . '/homeimage/images/' . $homeimage->filename;
     unlink($dir);
     $dir2 = FILES_DIR . '/homeimage/images/' . $homeimage->filename_hover;
     unlink($dir2);
     // End remove folders and all images
     if ($homeimage->delete()) {
         Flash::set('success', __('This homeimage has been deleted.'));
     } else {
         Flash::set('error', __('This homeimage could not be deleted!'));
     }
     redirect(get_url('homeimage'));
 }
开发者ID:sindotnet,项目名称:dashhotel,代码行数:19,代码来源:HomeimageController.php

示例4: delete_album

 function delete_album()
 {
     $this->_checkPermission();
     $paths = func_get_args();
     $id = urldecode(join('/', $paths));
     //Remove folders and all images
     $dir = FILES_DIR . '/gallery/images/' . $id . '/';
     foreach (glob($dir . '*.*') as $v) {
         unlink($v);
     }
     rmdir($dir);
     // End remove folders and all images
     $galleries = Record::findAllFrom('Gallery', 'album_id="' . $id . '"');
     if (count($galleries) > 0) {
         foreach ($galleries as $gallery) {
             // find the image to delete
             if ($delete_gallery = Record::findByIdFrom('Gallery', $gallery->id)) {
                 $delete_gallery->delete();
             }
         }
     }
     $album = Record::query('DELETE from ' . TABLE_PREFIX . 'album where id="' . $id . '"');
     $album->execute();
     Flash::set('success', __('This album has been deleted.'));
     redirect(get_url('gallery'));
 }
开发者ID:sindotnet,项目名称:canareef,代码行数:26,代码来源:GalleryController.php

示例5: challengeCookie

 /**
  * Checks if the cookie is still valid.
  *
  * @param string $cookie    Cookie's content.
  * @return boolean          True if cookie is valid, otherwise false.
  */
 private static final function challengeCookie($cookie)
 {
     $params = self::explodeCookie($cookie);
     if (isset($params['exp'], $params['id'], $params['digest'])) {
         if (!($user = Record::findByIdFrom('User', $params['id']))) {
             return false;
         }
         if (self::bakeUserCookie($params['exp'], $user) == $cookie && $params['exp'] > $_SERVER['REQUEST_TIME']) {
             return $user;
         }
     }
     return false;
 }
开发者ID:sindotnet,项目名称:cona,代码行数:19,代码来源:AuthUser.php

示例6: __

?>
</th>
      <th class="size" width=50><?php 
echo __('Order');
?>
</th>
      <th class="modify" width=50><?php 
echo __('Action');
?>
</th>
    </tr>
  </thead>
  <tbody>
<?php 
foreach ($banners as $banner) {
    $page = Record::findByIdFrom('Page', $banner->page_id);
    $type_detail = $banner->type == 'home' ? $banner->location : '';
    ?>
<!--ws 2/10/2015 for non-object prroperty problem-->
    <tr class="<?php 
    echo odd_even();
    ?>
">
      <td><?php 
    echo $banner->name;
    ?>
</td>
      <td><?php 
    echo $banner->filename != '' ? '<img src="' . BASE_FILES_DIR . '/banner/' . $banner->filename . '" width=100 />' : '';
    ?>
</td> 
开发者ID:sindotnet,项目名称:dashhotel,代码行数:31,代码来源:index.php

示例7: delete_mainimage

 function delete_mainimage($id)
 {
     $this->_checkPermission();
     $paths = func_get_args();
     $id = urldecode(join('/', $paths));
     $featureimage = Record::findByIdFrom('Facilities', $id);
     if ($featureimage) {
         $file = FILES_DIR . '/facilities/images/' . $featureimage->filename;
         $filename = array_pop($paths);
         $paths = join('/', $paths);
         if (is_file($file)) {
             if (!unlink($file)) {
                 Flash::set('error', __('Permission denied!'));
             }
         }
         //$featureimage->filename="";
         // delete record
         if ($featureimage->update('Facilities', array('filename' => ''), 'id=' . $id)) {
             Flash::set('success', __('This  image has been deleted.'));
         } else {
             Flash::set('error', __('This image could not be deleted!'));
         }
     } else {
         Flash::set('error', __('image could not be found!'));
     }
     redirect(get_url('facilities/edit/' . $featureimage->id));
 }
开发者ID:sindotnet,项目名称:dashhotel,代码行数:27,代码来源:FacilitiesController.php

示例8: __

?>
</th>
      <th class="size" width=50><?php 
echo __('Order');
?>
</th>
      <th class="modify" width=50><?php 
echo __('Action');
?>
</th>
    </tr>
  </thead>
  <tbody>
<?php 
foreach ($abouts as $about) {
    $page = Record::findByIdFrom('Page', $about->page_id);
    $type_detail = $about->type == 'home' ? $about->location : '';
    ?>
<!--ws 2/10/2015 for non-object prroperty problem-->
    <tr class="<?php 
    echo odd_even();
    ?>
">
      <td><?php 
    echo $about->name;
    ?>
</td>
      <td><?php 
    echo $about->filename != '' ? '<img src="' . BASE_FILES_DIR . '/about/' . $about->filename . '" width=100 />' : '';
    ?>
</td> 
开发者ID:sindotnet,项目名称:tiigo,代码行数:31,代码来源:index.php

示例9: _store


//.........这里部分代码省略.........
     foreach ($fields as $field) {
         if (isset($data[$field])) {
             $data[$field] = trim($data[$field]);
             if (!empty($data[$field]) && !(bool) preg_match('/^[0-9]{2}:[0-9]{2}:[0-9]{2}$/D', (string) $data[$field])) {
                 $errors[] = __('Illegal value for :fieldname field!', array(':fieldname' => $field));
             }
         }
     }
     // Check alphanumerical fields
     $fields = array('keywords', 'description');
     foreach ($fields as $field) {
         use_helper('Kses');
         $data[$field] = kses(trim($data[$field]), array());
         /*
                     if (!empty($data[$field]) && !Validate::alpha_comma($data[$field])) {
            $errors[] = __('Illegal value for :fieldname field!', array(':fieldname' => $field));
                     }
         *
         */
     }
     // Check behaviour_id field
     if (!empty($data['behaviour_id']) && !Validate::slug($data['behaviour_id'])) {
         $errors[] = __('Illegal value for :fieldname field!', array(':fieldname' => 'behaviour_id'));
     }
     // Make sure the title doesn't contain HTML
     if (Setting::get('allow_html_title') == 'off') {
         use_helper('Kses');
         $data['title'] = kses(trim($data['title']), array());
     }
     // Create the page object to be manipulated and populate data
     if ($action == 'add') {
         $page = new Page($data);
     } else {
         $page = Record::findByIdFrom('Page', $id);
         $page->setFromData($data);
     }
     // Upon errors, rebuild original page and return to screen with errors
     if (false !== $errors || $error_fields !== false) {
         $tags = $_POST['page_tag'];
         // Rebuild time fields
         if (isset($page->created_on) && isset($page->created_on_time)) {
             $page->created_on = $page->created_on . ' ' . $page->created_on_time;
         }
         if (isset($page->published_on) && isset($page->published_on_time)) {
             $page->published_on = $page->published_on . ' ' . $page->published_on_time;
         }
         if (isset($page->valid_until)) {
             $page->valid_until = $page->valid_until . ' ' . $page->valid_until_time;
         }
         // Rebuild parts
         $part = '';
         if (!empty($_POST['part'])) {
             $part = $_POST['part'];
             $tmp = false;
             foreach ($part as $key => $val) {
                 $tmp[$key] = (object) $val;
             }
             $part = $tmp;
         }
         // Set the errors to be displayed.
         $err_msg = $errors != false ? implode('<br/>', $errors) : '';
         $err_msg .= $error_fields != false ? '<br />Please specify these fields: ' . implode(', ', $error_fields) : '';
         Flash::setNow('error', $err_msg);
         //$settingdata = 'aaa';
         // display things ...
         $this->setLayout('backend');
开发者ID:sindotnet,项目名称:canareef,代码行数:67,代码来源:PageController.php

示例10: copy

 /**
  * Ajax action to copy a page or page tree
  *
  */
 function copy($parent_id)
 {
     parse_str($_POST['data']);
     $page = Record::findByIdFrom('Page', $dragged_id);
     $new_root_id = Page::cloneTree($page, $parent_id);
     foreach ($pages as $position => $page_id) {
         if ($page_id == $dragged_id) {
             /* Move the cloned tree, not original. */
             $page = Record::findByIdFrom('Page', $new_root_id);
         } else {
             $page = Record::findByIdFrom('Page', $page_id);
         }
         $page->position = (int) $position;
         $page->parent_id = (int) $parent_id;
         $page->save();
     }
 }
开发者ID:albertobraschi,项目名称:toad,代码行数:21,代码来源:PageController.php

示例11: delete_category

 function delete_category()
 {
     $this->_checkPermission();
     $paths = func_get_args();
     $id = urldecode(join('/', $paths));
     $category = Record::findByIdFrom('NewsCategory', $id);
     //Remove all news folders and all images
     $news_arr = News::findByCatId($id);
     foreach ($news_arr as $news) {
         $dir = FILES_DIR . '/news/images/' . $news->filename;
         unlink($dir);
         if ($news->delete()) {
         }
     }
     // End remove all news folders and all images
     if ($category->delete()) {
         Flash::set('success', __('This category has been deleted.'));
     } else {
         Flash::set('error', __('This category could not be deleted!'));
     }
     redirect(get_url('news'));
 }
开发者ID:sindotnet,项目名称:canareef,代码行数:22,代码来源:NewsController.php

示例12: delete_location

 function delete_location($id)
 {
     $this->_checkPermission();
     $paths = func_get_args();
     $id = urldecode(join('/', $paths));
     $location = Record::findByIdFrom('Location', $id);
     if ($location) {
         $file = FILES_DIR . '/fnb/location/' . $location->filename;
         $filename = array_pop($paths);
         $paths = join('/', $paths);
         if (is_file($file)) {
             if (!unlink($file)) {
                 Flash::set('error', __('Permission denied!'));
             }
         }
         // delete record
         if ($location->delete()) {
             Flash::set('success', __('This location has been deleted.'));
         } else {
             Flash::set('error', __('This Location could not be deleted!'));
         }
     } else {
         Flash::set('error', __('Location could not be found!'));
     }
     redirect(get_url('fnb/edit/' . $location->fnbid));
 }
开发者ID:sindotnet,项目名称:dashhotel,代码行数:26,代码来源:FnbController.php

示例13: callback_view_page

 /**
  * View callback function. Adds the page_part_form to the admin page.
  *
  * @param page the current page to edit
  */
 public static function callback_view_page($page)
 {
     // Because the metadata is not visible, we can't use $page->metadata[self::PLUGIN_ID]
     if (isset($page->id) && ($form = PageMetadata::FindOneByPageAndKeyword($page->id, self::PLUGIN_ID)) || ($form = PageMetadata::FindOneByPageAndKeyword($page->parent_id, self::PLUGIN_ID . '_children'))) {
         if ($definition = Record::findByIdFrom('PagePartForm', $form->value)) {
             // Convert page_parts array to hash
             $page_parts = array();
             if (isset($page->id)) {
                 foreach (PagePart::findByPageId($page->id) as $page_part) {
                     $page_parts[$page_part->name] = $page_part;
                 }
             }
             // Add the page_part_form to the admin view
             self::Get_instance()->create_view('observers/page_form', array('page' => $page, 'page_parts' => $page_parts, 'structure' => self::Get_structure($definition)))->display();
         }
     }
 }
开发者ID:billzeller,项目名称:frog_page_part_forms,代码行数:22,代码来源:PagePartFormsController.php

示例14: edit

 public function edit($id)
 {
     if ($_POST["action"] == "edit") {
         $data = $_POST['sidebarlink'];
         Flash::set('postdata', $data);
         $sidebarlink = Record::findByIdFrom('SidebarLink', $id);
         if (!$sidebarlink) {
             Flash::set('error', __('Sidebar link is not found!'));
             redirect(get_url('sidebarlink'));
         }
         $sidebarlink->setFromData($data);
         $sidebarlink->updated_by_id = AuthUser::getId();
         $sidebarlink->updated_on = date('Y-m-d H:i:s');
         if (!$sidebarlink->save()) {
             Flash::set('error', __('Sidebar link is not updated!'));
             redirect(get_url('sidebarlink/view/' . $id));
         } else {
             $this->upload($id);
             Flash::set('success', __('Sidebar link has been updated!'));
             if (isset($_POST['commit'])) {
                 redirect(get_url('sidebarlink'));
             } else {
                 redirect(get_url('sidebarlink/view/' . $id));
             }
         }
     }
 }
开发者ID:sindotnet,项目名称:cona,代码行数:27,代码来源:SidebarlinkController.php

示例15: cloneTree

 public static function cloneTree($page, $parent_id)
 {
     /* This will hold new id of root of cloned tree. */
     static $new_root_id = false;
     /* Clone passed in page. */
     $clone = Record::findByIdFrom('Page', $page->id);
     $clone->parent_id = (int) $parent_id;
     $clone->id = null;
     $clone->title .= " (copy)";
     $clone->slug .= "-copy";
     $clone->save();
     /* Also clone the page parts. */
     $page_part = PagePart::findByPageId($page->id);
     if (count($page_part)) {
         foreach ($page_part as $part) {
             $part->page_id = $clone->id;
             $part->id = null;
             $part->save();
         }
     }
     /* This gets set only once even when called recursively. */
     if (!$new_root_id) {
         $new_root_id = $clone->id;
     }
     /* Clone and update childrens parent_id to clones new id. */
     if (Page::hasChildren($page->id)) {
         foreach (Page::childrenOf($page->id) as $child) {
             Page::cloneTree($child, $clone->id);
         }
     }
     return $new_root_id;
 }
开发者ID:chaobj001,项目名称:tt,代码行数:32,代码来源:Page.php


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