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


PHP Field::init方法代码示例

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


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

示例1: init

 function init()
 {
     parent::init();
     $this->defaultValue(false);
     $this->type('boolean');
     $this->owner->addCondition($this->short_name, false);
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:7,代码来源:Deleted.php

示例2: init

 public function init()
 {
     parent::init();
     if ($this->action == 'edit') {
         $this->addJS();
     }
 }
开发者ID:Akrobate,项目名称:akrocrm,代码行数:7,代码来源:time.php

示例3: init

 protected function init()
 {
     parent::init();
     $this->addValidator(function () {
         if ($this->multiple && array_diff($this->value, array_keys($this->values))) {
             return Lang::trans('SELECT_INVALID_VALUE');
         }
     });
 }
开发者ID:pashist,项目名称:miniform,代码行数:9,代码来源:Select.php

示例4: init

 function init()
 {
     parent::init();
     if ($this->json) {
         $this->encode = function ($t) {
             return json_encode($t);
         };
         $this->decode = function ($t) {
             return json_decode($t, true);
         };
     }
 }
开发者ID:easyconn,项目名称:atk4,代码行数:12,代码来源:ContainsMany.php

示例5: getField

 public function getField($input)
 {
     global $Database;
     if (isset($input['x']) && isset($input['y'])) {
         $x = $input['x'];
         $y = $input['y'];
     } elseif (isset($input['col']) && isset($input['row'])) {
         $cols = explode(' ', 'a b c d e f g h i j k l m n o p q r s t u v w x y z');
         $x = array_search($input['col'], $cols);
         $y = $input['row'] - 1;
     }
     $id = $Database->getID('fields', array('board_id' => $this->id, 'x' => $x, 'y' => $y));
     $Field = new Field();
     $Field->id = $id;
     $Field->init();
     return $Field;
 }
开发者ID:LovagiasParaszt,项目名称:phpscrabble,代码行数:17,代码来源:model.Board.php

示例6: init

 /**
  *	Surcharge de l'initialisation
  *
  */
 public function init()
 {
     parent::init();
     $this->joinid = $this->value['id'];
     $this->joinfieldvalue = $this->value[$this->fieldtoshow];
 }
开发者ID:Akrobate,项目名称:akrocrm,代码行数:10,代码来源:join.php

示例7: init

 public function init()
 {
     parent::init();
     $this->type('reference_id');
 }
开发者ID:atk4,项目名称:atk4,代码行数:5,代码来源:Field.php

示例8: init

 public function init()
 {
     parent::init();
     $this->editable(false);
 }
开发者ID:atk4,项目名称:atk4,代码行数:5,代码来源:Callback.php

示例9: playword

 function playword($params)
 {
     global $Database;
     // Check parameter count
     if (count($params) < 4) {
         die('Wrong parameter count!');
     }
     // Check if user is logged in
     if (!$this->Auth->isLoggedIn()) {
         $this->redirect(array('controller' => 'users', 'action' => 'login'));
     }
     // check game
     $Game = new Game();
     $Game->id = trim($params[0]);
     $Game->init();
     if (!empty($Game->data)) {
         if ($Game->ActiveUser->id != $this->Auth->User->id) {
             $this->redirect(array('controller' => 'games', 'action' => 'view', 'params' => array($Game->id)));
         }
     }
     // check field
     $Field = new Field();
     $Field->id = trim($params[1]);
     $Field->init();
     if (!empty($Field->data)) {
         if ($Field->data['board_id'] != $Game->Board->id) {
             $this->redirect(array('controller' => 'games', 'action' => 'view', 'params' => array($Game->id)));
         }
     }
     // check direction
     $direction = substr($params[3], 0, 1);
     if ($direction == 'f') {
         $direction = 'h';
     }
     // 'false': *one letter*
     if (!in_array($direction, array('h', 'v'))) {
         die('Incorrect direction: ' . $direction);
     }
     // check word for empty
     $word = $params[2];
     $letters = str_split($word);
     if (empty($letters)) {
         $this->redirect(array('controller' => 'games', 'action' => 'view', 'params' => array($Game->id)));
     }
     // get rack tiles
     $rack_tiles = $Database->fetchObjects('Tile', "\r\n\t\t\tSELECT `tile_id` FROM `rack_tiles`\r\n\t\t\tWHERE `game_id` = {$Game->id}\r\n\t\t\t  AND `user_id` = {$this->Auth->User->id}\r\n\t\t");
     // the real, letter by letter, check
     $to_update = array();
     foreach ($letters as $i => $letter) {
         // get x and y for this letter
         $x = $Field->data['x'];
         $y = $Field->data['y'];
         if ($direction == 'h') {
             $x += $i;
         } elseif ($direction == 'v') {
             $y += $i;
         }
         // check if field exists
         $field_id = $Database->getID('fields', array('board_id' => $Game->Board->id, 'x' => $x, 'y' => $y));
         // check if word fits in board
         if (!$field_id) {
             die('Field does not exist!');
         }
         // (double) check if field exists
         $TheField = new Field();
         $TheField->id = $field_id;
         $TheField->init();
         if (empty($TheField->data)) {
             die('Field does not exist! o3qaigksd');
         }
         // check if field is free, if not, if the letter is the specified letter
         $placed_tile_id = $Database->getID('placed_tiles', array('game_id' => $Game->Board->id, 'field_id' => $TheField->id));
         if ($placed_tile_id) {
             $rows = $Database->fetchObjects('Tile', "\r\n\t\t\t\t\tSELECT `tile_id` AS `id` FROM `placed_tiles` WHERE `id` = {$placed_tile_id}\r\n\t\t\t\t");
             $Tile = $rows[0];
             if (strtoupper($Tile->data['letter']) != strtoupper($letter)) {
                 die('Field at (' . $x . ', ' . $y . ') already used, and other letter than specified!');
             }
             // everything's okay for this letter! ..DO NOT put it in the to_update array,
             // because letter is already played!
         } else {
             // check if letter is in rack, and if: what is it's tile id?
             $TheTile = false;
             foreach ($rack_tiles as $key => $Tile) {
                 if (strtoupper($Tile->data['letter']) == strtoupper($letter)) {
                     $TheTile = $Tile;
                     unset($rack_tiles[$key]);
                     break;
                     // let's not use tiles twice.. ;)
                 }
             }
             if (!$TheTile) {
                 die('You do not have the letter ' . strtoupper($letter) . '!');
             }
             // everything's okay for this letter! ..put it in the to_update array (hooray)!
             $to_update[] = "\r\n\t\t\t\t\tDELETE FROM `rack_tiles`\r\n\t\t\t\t\tWHERE `game_id` = {$Game->id}\r\n\t\t\t\t\t  AND `user_id` = {$this->Auth->User->id}\r\n\t\t\t\t\t  AND `tile_id` = {$TheTile->id}\r\n\t\t\t\t\tLIMIT 1\r\n\t\t\t\t";
             $to_update[] = "\r\n\t\t\t\t\tINSERT INTO `placed_tiles` (`game_id`, `tile_id`, `field_id`) VALUES\r\n\t\t\t\t\t({$Game->id}, {$TheTile->id}, {$TheField->id});\r\n\t\t\t\t";
         }
     }
     // wow, did we really survive all the checks?! celebrate!
//.........这里部分代码省略.........
开发者ID:LovagiasParaszt,项目名称:phpscrabble,代码行数:101,代码来源:controller.GamesController.php

示例10: displayName

<?php

namespace ATPContact\Model;

class Field extends \ATP\ActiveRecord
{
    public function displayName()
    {
        return $this->label;
    }
}
Field::init();
开发者ID:daemonalchemist,项目名称:atp-contact,代码行数:12,代码来源:Field.php


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